diff --git a/Cargo.lock b/Cargo.lock
index b0d2fbca6a..1bfc20ed17 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -875,6 +875,16 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "cargo_toml"
+version = "0.16.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3f9629bc6c4388ea699781dc988c2b99766d7679b151c81990b4fa1208fafd3"
+dependencies = [
+ "serde",
+ "toml 0.8.2",
+]
+
[[package]]
name = "cc"
version = "1.0.79"
@@ -1186,8 +1196,9 @@ name = "core-primitives"
version = "0.9.12"
dependencies = [
"frame-support",
- "itp-utils",
+ "litentry-hex-utils",
"litentry-macros",
+ "litentry-proc-macros",
"pallet-evm",
"parity-scale-codec",
"ring 0.16.20",
@@ -4402,14 +4413,6 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
-[[package]]
-name = "itp-utils"
-version = "0.9.0"
-dependencies = [
- "hex",
- "parity-scale-codec",
-]
-
[[package]]
name = "jobserver"
version = "0.1.26"
@@ -5435,14 +5438,17 @@ dependencies = [
]
[[package]]
-name = "litentry-macros"
+name = "litentry-hex-utils"
version = "0.9.12"
dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.48",
+ "hex",
+ "parity-scale-codec",
]
+[[package]]
+name = "litentry-macros"
+version = "0.9.12"
+
[[package]]
name = "litentry-parachain-runtime"
version = "0.9.17"
@@ -5524,6 +5530,16 @@ dependencies = [
"xcm-simulator",
]
+[[package]]
+name = "litentry-proc-macros"
+version = "0.9.12"
+dependencies = [
+ "cargo_toml",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.48",
+]
+
[[package]]
name = "litmus-parachain-runtime"
version = "0.9.17"
@@ -9823,7 +9839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
"once_cell",
- "toml_edit",
+ "toml_edit 0.19.14",
]
[[package]]
@@ -14027,7 +14043,19 @@ dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
- "toml_edit",
+ "toml_edit 0.19.14",
+]
+
+[[package]]
+name = "toml"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
+dependencies = [
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_edit 0.20.2",
]
[[package]]
@@ -14052,6 +14080,19 @@ dependencies = [
"winnow",
]
+[[package]]
+name = "toml_edit"
+version = "0.20.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
+dependencies = [
+ "indexmap 2.0.0",
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
+]
+
[[package]]
name = "tower"
version = "0.4.13"
diff --git a/Cargo.toml b/Cargo.toml
index 25f8a177fb..1ea3e746d3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,9 @@ members = [
'precompiles/*',
'primitives/common',
'primitives/core',
+ 'primitives/core/proc-macros',
'primitives/core/macros',
+ 'primitives/hex',
'primitives/sidechain',
'primitives/teeracle',
'primitives/teerex',
diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml
index b42ebebf71..da25b3b95d 100644
--- a/primitives/core/Cargo.toml
+++ b/primitives/core/Cargo.toml
@@ -19,8 +19,9 @@ sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
-itp-utils = { path = "../../tee-worker/core-primitives/utils", default-features = false }
+litentry-hex-utils = { path = "../hex", default-features = false }
litentry-macros = { path = "macros" }
+litentry-proc-macros = { path = "proc-macros" }
[features]
default = ["std"]
@@ -35,6 +36,5 @@ std = [
"sp-std/std",
"sp-io/std",
"ring/std",
- "itp-utils/std",
"pallet-evm/std",
]
diff --git a/primitives/core/macros/Cargo.toml b/primitives/core/macros/Cargo.toml
index 3743df47f7..c4f4e3ff25 100644
--- a/primitives/core/macros/Cargo.toml
+++ b/primitives/core/macros/Cargo.toml
@@ -4,11 +4,3 @@ description = 'Proc-macros used by Litentry crates.'
name = "litentry-macros"
version = "0.9.12"
edition = "2021"
-
-[lib]
-proc-macro = true
-
-[dependencies]
-proc-macro2 = { version = "1" }
-quote = { version = "1" }
-syn = { version = "2", features = ["full", "visit-mut"] }
diff --git a/primitives/core/macros/src/lib.rs b/primitives/core/macros/src/lib.rs
index e988af4ccb..9494db3e0c 100644
--- a/primitives/core/macros/src/lib.rs
+++ b/primitives/core/macros/src/lib.rs
@@ -13,81 +13,24 @@
//
// You should have received a copy of the GNU General Public License
// along with Litentry. If not, see .
-
-#![allow(clippy::tabs_in_doc_comments)]
-
-use proc_macro::TokenStream;
-use reuse::handle_reuse;
-use syn::{parse_macro_input, Error};
-
-mod reuse;
-
-/**
-This macro is used to reuse implementations when the rust's trait system cannot gracefully express the abstraction.
-
-This works similar with `#[cfg(..)]` that sets the target only appear on the specified cases.
-
-# Usage:
-
-```
-use litentry_macros::reuse;
-
-#[reuse(x, y)] . // Define the cases that the following implementation expands for each one
-mod __ { // Leave mod name with double discards, which is to be replaced by the cases
- #[x] // This item would only appear on case `x`
- fn u() {
- __
- }
-
- #[y] // This item would only appear on case `y`
- fn v(a: String) {
- println!("hello world!")
- }
-
- #[x] // Specifying multiple cases indicates that the item would appear on all of them
- #[y] .// This behaviour is designed to be different from `#[cfg(..)]`
- fn a() -> i32 {
- #[x] // This statement would only appear on case `x`
- let p = 1;
- #[y] // This statement would only appear on case `y`
- let p = 2;
- p + 1
- }
-
-
- fn g<#[x] 'a, #[y] T>(#[x] a: i32, #[y] a: u32) {}
-}
-
-```
-Expands to:
-```
-mod x {
- fn a() -> i32 {
- let p = 1;
- p + 1
- }
- fn u() {
- println!("hello world!");
- }
- fn g<'a>(a: i32) {}
-}
-
-mod y {
- fn a() -> i32 {
- let p = 2;
- p + 1
- }
- fn v(a: String) {
- println!("hello world!");
- }
- fn g(a: u32) {}
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[macro_export]
+macro_rules! if_production_or {
+ ($prod_variant:expr, $non_prod_variant:expr) => {
+ if cfg!(feature = "production") {
+ $prod_variant
+ } else {
+ $non_prod_variant
+ }
+ };
}
-```
-*/
-#[proc_macro_attribute]
-pub fn reuse(args: TokenStream, input: TokenStream) -> TokenStream {
- handle_reuse(parse_macro_input!(args), parse_macro_input!(input))
- .unwrap_or_else(Error::into_compile_error)
- .into()
+#[macro_export]
+macro_rules! if_not_production {
+ ($expression:expr) => {
+ if cfg!(not(feature = "production")) {
+ $expression
+ }
+ };
}
diff --git a/primitives/core/proc-macros/Cargo.toml b/primitives/core/proc-macros/Cargo.toml
new file mode 100644
index 0000000000..3c7ddb598e
--- /dev/null
+++ b/primitives/core/proc-macros/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+authors = ['Trust Computing GmbH ']
+description = 'Proc-macros used by Litentry crates.'
+name = "litentry-proc-macros"
+version = "0.9.12"
+edition = "2021"
+
+[lib]
+proc-macro = true
+
+[dependencies]
+cargo_toml = "0.16.3"
+proc-macro2 = { version = "1" }
+quote = { version = "1" }
+syn = { version = "2", features = ["full", "visit-mut"] }
diff --git a/tee-worker/litentry/macros/src/lib.rs b/primitives/core/proc-macros/src/lib.rs
similarity index 56%
rename from tee-worker/litentry/macros/src/lib.rs
rename to primitives/core/proc-macros/src/lib.rs
index f76bbe03c0..16ac88fe39 100644
--- a/tee-worker/litentry/macros/src/lib.rs
+++ b/primitives/core/proc-macros/src/lib.rs
@@ -14,10 +14,86 @@
// You should have received a copy of the GNU General Public License
// along with Litentry. If not, see .
+#![allow(clippy::tabs_in_doc_comments)]
+
use cargo_toml::{Dependency, Manifest};
use proc_macro::TokenStream;
use quote::quote;
+use reuse::handle_reuse;
use std::fs;
+use syn::{parse_macro_input, Error};
+
+mod reuse;
+
+/**
+This macro is used to reuse implementations when the rust's trait system cannot gracefully express the abstraction.
+
+This works similar with `#[cfg(..)]` that sets the target only appear on the specified cases.
+
+# Usage:
+
+```
+use litentry_proc_macros::reuse;
+
+#[reuse(x, y)] . // Define the cases that the following implementation expands for each one
+mod __ { // Leave mod name with double discards, which is to be replaced by the cases
+ #[x] // This item would only appear on case `x`
+ fn u() {
+ __
+ }
+
+ #[y] // This item would only appear on case `y`
+ fn v(a: String) {
+ println!("hello world!")
+ }
+
+ #[x] // Specifying multiple cases indicates that the item would appear on all of them
+ #[y] .// This behaviour is designed to be different from `#[cfg(..)]`
+ fn a() -> i32 {
+ #[x] // This statement would only appear on case `x`
+ let p = 1;
+ #[y] // This statement would only appear on case `y`
+ let p = 2;
+ p + 1
+ }
+
+
+ fn g<#[x] 'a, #[y] T>(#[x] a: i32, #[y] a: u32) {}
+}
+
+```
+Expands to:
+```
+mod x {
+ fn a() -> i32 {
+ let p = 1;
+ p + 1
+ }
+ fn u() {
+ println!("hello world!");
+ }
+ fn g<'a>(a: i32) {}
+}
+
+mod y {
+ fn a() -> i32 {
+ let p = 2;
+ p + 1
+ }
+ fn v(a: String) {
+ println!("hello world!");
+ }
+ fn g(a: u32) {}
+}
+
+```
+*/
+#[proc_macro_attribute]
+pub fn reuse(args: TokenStream, input: TokenStream) -> TokenStream {
+ handle_reuse(parse_macro_input!(args), parse_macro_input!(input))
+ .unwrap_or_else(Error::into_compile_error)
+ .into()
+}
#[proc_macro]
pub fn local_modules(_item: TokenStream) -> TokenStream {
@@ -46,7 +122,8 @@ fn read_module_names(path: &str, relative_to: &str, module_names: &mut Vec']
+description = 'Litentry hex utils'
+name = "litentry-hex-utils"
+version = "0.9.12"
+edition = "2021"
+
+[dependencies]
+hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
+
+[dev-dependencies]
+codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
+
+
+[features]
+default = ["std"]
+std = [
+ "hex/std",
+]
diff --git a/primitives/hex/src/lib.rs b/primitives/hex/src/lib.rs
new file mode 100644
index 0000000000..b9015815ba
--- /dev/null
+++ b/primitives/hex/src/lib.rs
@@ -0,0 +1,69 @@
+// Copyright 2020-2024 Trust Computing GmbH.
+// This file is part of Litentry.
+//
+// Litentry is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Litentry 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Litentry. If not, see .
+#![cfg_attr(not(feature = "std"), no_std)]
+
+extern crate alloc;
+use alloc::{string::String, vec::Vec};
+
+use hex::FromHexError;
+
+/// Hex encodes given data and preappends a "0x".
+pub fn hex_encode(data: &[u8]) -> String {
+ let mut hex_str = hex::encode(data);
+ hex_str.insert_str(0, "0x");
+ hex_str
+}
+
+/// Helper method for decoding hex.
+pub fn decode_hex>(message: T) -> Result, FromHexError> {
+ let message = message.as_ref();
+ let message = match message {
+ [b'0', b'x', hex_value @ ..] => hex_value,
+ _ => message,
+ };
+
+ let decoded_message = hex::decode(message)?;
+ Ok(decoded_message)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use alloc::string::ToString;
+ use codec::{Decode, Encode};
+
+ #[test]
+ fn hex_encode_decode_works() {
+ let data = "Hello World!".to_string();
+
+ let hex_encoded_data = hex_encode(&data.encode());
+ let decoded_data =
+ String::decode(&mut decode_hex(hex_encoded_data).unwrap().as_slice()).unwrap();
+
+ assert_eq!(data, decoded_data);
+ }
+
+ #[test]
+ fn hex_encode_decode_works_empty_input() {
+ let data = String::new();
+
+ let hex_encoded_data = hex_encode(&data.encode());
+ let decoded_data =
+ String::decode(&mut decode_hex(hex_encoded_data).unwrap().as_slice()).unwrap();
+
+ assert_eq!(data, decoded_data);
+ }
+}
diff --git a/tee-worker/Cargo.lock b/tee-worker/Cargo.lock
index 08913fa98f..8882ec6ce8 100644
--- a/tee-worker/Cargo.lock
+++ b/tee-worker/Cargo.lock
@@ -973,7 +973,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3f9629bc6c4388ea699781dc988c2b99766d7679b151c81990b4fa1208fafd3"
dependencies = [
"serde 1.0.193",
- "toml 0.8.0",
+ "toml 0.8.2",
]
[[package]]
@@ -1305,8 +1305,9 @@ name = "core-primitives"
version = "0.9.12"
dependencies = [
"frame-support",
- "itp-utils",
- "litentry-macros 0.9.12",
+ "litentry-hex-utils",
+ "litentry-macros",
+ "litentry-proc-macros",
"pallet-evm 6.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42)",
"parity-scale-codec",
"ring 0.16.20",
@@ -4524,6 +4525,7 @@ dependencies = [
"itp-types",
"itp-utils",
"lc-scheduled-enclave",
+ "litentry-hex-utils",
"litentry-primitives",
"log 0.4.20",
"parity-scale-codec",
@@ -4577,6 +4579,7 @@ dependencies = [
"itp-types",
"itp-utils",
"lc-stf-task-sender",
+ "litentry-macros",
"litentry-primitives",
"log 0.4.20",
"pallet-balances",
@@ -5453,6 +5456,7 @@ name = "itp-utils"
version = "0.9.0"
dependencies = [
"hex 0.4.3",
+ "litentry-hex-utils",
"parity-scale-codec",
]
@@ -5534,6 +5538,7 @@ dependencies = [
"its-test",
"its-validateer-fetch",
"lc-scheduled-enclave",
+ "litentry-hex-utils",
"log 0.4.20",
"parity-scale-codec",
"sgx_tstd",
@@ -6139,6 +6144,7 @@ dependencies = [
"lc-data-providers",
"lc-mock-server",
"lc-stf-task-sender",
+ "litentry-hex-utils",
"litentry-primitives",
"log 0.4.20",
"pallet-parachain-staking",
@@ -6170,6 +6176,7 @@ dependencies = [
"lc-mock-server",
"lc-service",
"lc-stf-task-sender",
+ "litentry-hex-utils",
"litentry-primitives",
"log 0.4.20",
"parity-scale-codec",
@@ -6251,6 +6258,7 @@ dependencies = [
"itp-stf-primitives",
"itp-utils",
"lc-mock-server",
+ "litentry-macros",
"litentry-primitives",
"log 0.4.20",
"parity-scale-codec",
@@ -6424,6 +6432,7 @@ dependencies = [
"lc-stf-task-receiver",
"lc-stf-task-sender",
"lc-vc-task-sender",
+ "litentry-macros",
"litentry-primitives",
"log 0.4.20",
"pallet-identity-management-tee",
@@ -7089,6 +7098,7 @@ dependencies = [
"itp-types",
"itp-utils",
"lc-credentials",
+ "litentry-hex-utils",
"litentry-primitives",
"log 0.4.20",
"pallet-balances",
@@ -7117,21 +7127,15 @@ dependencies = [
]
[[package]]
-name = "litentry-macros"
-version = "0.1.0"
+name = "litentry-hex-utils"
+version = "0.9.12"
dependencies = [
- "cargo_toml",
- "quote",
+ "hex 0.4.3",
]
[[package]]
name = "litentry-macros"
version = "0.9.12"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.32",
-]
[[package]]
name = "litentry-primitives"
@@ -7144,6 +7148,7 @@ dependencies = [
"hex 0.4.3",
"itp-sgx-crypto",
"itp-utils",
+ "litentry-hex-utils",
"log 0.4.20",
"pallet-evm 6.0.0-dev (git+https://github.com/integritee-network/frontier.git?branch=bar/polkadot-v0.9.42)",
"parity-scale-codec",
@@ -7163,6 +7168,16 @@ dependencies = [
"teerex-primitives",
]
+[[package]]
+name = "litentry-proc-macros"
+version = "0.9.12"
+dependencies = [
+ "cargo_toml",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.32",
+]
+
[[package]]
name = "litentry-worker"
version = "0.0.1"
@@ -7203,6 +7218,8 @@ dependencies = [
"lc-data-providers",
"lc-mock-server",
"lc-stf-task-sender",
+ "litentry-hex-utils",
+ "litentry-macros",
"litentry-primitives",
"log 0.4.20",
"mockall",
@@ -14799,14 +14816,14 @@ dependencies = [
[[package]]
name = "toml"
-version = "0.8.0"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c226a7bba6d859b63c92c4b4fe69c5b6b72d0cb897dbc8e6012298e6154cb56e"
+checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
dependencies = [
"serde 1.0.193",
"serde_spanned",
"toml_datetime",
- "toml_edit 0.20.0",
+ "toml_edit 0.20.2",
]
[[package]]
@@ -14833,9 +14850,9 @@ dependencies = [
[[package]]
name = "toml_edit"
-version = "0.20.0"
+version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ff63e60a958cefbb518ae1fd6566af80d9d4be430a33f3723dfc47d1d411d95"
+checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [
"indexmap 2.0.0",
"serde 1.0.193",
diff --git a/tee-worker/Cargo.toml b/tee-worker/Cargo.toml
index 8aaf35264a..120306da83 100644
--- a/tee-worker/Cargo.toml
+++ b/tee-worker/Cargo.toml
@@ -72,7 +72,6 @@ members = [
"sidechain/state",
"sidechain/validateer-fetch",
"litentry/primitives",
- "litentry/macros",
"litentry/pallets/identity-management",
"litentry/core/stf-task/sender",
"litentry/core/stf-task/receiver",
diff --git a/tee-worker/app-libs/parentchain-interface/Cargo.toml b/tee-worker/app-libs/parentchain-interface/Cargo.toml
index 39e4827588..59ec735302 100644
--- a/tee-worker/app-libs/parentchain-interface/Cargo.toml
+++ b/tee-worker/app-libs/parentchain-interface/Cargo.toml
@@ -29,6 +29,7 @@ sp-runtime = { default-features = false, git = "https://github.com/paritytech/su
# litentry
lc-scheduled-enclave = { path = "../../litentry/core/scheduled-enclave", default-features = false, optional = true }
+litentry-hex-utils = { path = "../../../primitives/hex", default-features = false }
litentry-primitives = { path = "../../litentry/primitives", default-features = false }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
diff --git a/tee-worker/app-libs/parentchain-interface/src/integritee/event_handler.rs b/tee-worker/app-libs/parentchain-interface/src/integritee/event_handler.rs
index 1cc6cd3d0e..c8111afae0 100644
--- a/tee-worker/app-libs/parentchain-interface/src/integritee/event_handler.rs
+++ b/tee-worker/app-libs/parentchain-interface/src/integritee/event_handler.rs
@@ -22,7 +22,7 @@ use ita_stf::{Getter, TrustedCall, TrustedCallSigned};
use itc_parentchain_indirect_calls_executor::error::Error;
use itp_stf_primitives::{traits::IndirectExecutor, types::TrustedOperation};
use itp_types::parentchain::{AccountId, FilterEvents, HandleParentchainEvents, ParentchainError};
-use itp_utils::hex::hex_encode;
+use litentry_hex_utils::hex_encode;
use log::*;
pub struct ParentchainEventHandler {}
diff --git a/tee-worker/app-libs/parentchain-interface/src/target_a/event_handler.rs b/tee-worker/app-libs/parentchain-interface/src/target_a/event_handler.rs
index 7ea752aa55..cb02df3e2a 100644
--- a/tee-worker/app-libs/parentchain-interface/src/target_a/event_handler.rs
+++ b/tee-worker/app-libs/parentchain-interface/src/target_a/event_handler.rs
@@ -22,7 +22,7 @@ use ita_stf::{Getter, TrustedCall, TrustedCallSigned};
use itc_parentchain_indirect_calls_executor::error::Error;
use itp_stf_primitives::{traits::IndirectExecutor, types::TrustedOperation};
use itp_types::parentchain::{AccountId, FilterEvents, HandleParentchainEvents, ParentchainError};
-use itp_utils::hex::hex_encode;
+use litentry_hex_utils::hex_encode;
use log::*;
pub struct ParentchainEventHandler {}
diff --git a/tee-worker/app-libs/stf/Cargo.toml b/tee-worker/app-libs/stf/Cargo.toml
index 9c6dd0aad8..71ea86671e 100644
--- a/tee-worker/app-libs/stf/Cargo.toml
+++ b/tee-worker/app-libs/stf/Cargo.toml
@@ -41,6 +41,7 @@ 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 }
+litentry-macros = { path = "../../../primitives/core/macros", default-features = false }
litentry-primitives = { path = "../../litentry/primitives", default-features = false }
pallet-parentchain = { path = "../../../pallets/parentchain", default-features = false }
diff --git a/tee-worker/app-libs/stf/src/getter.rs b/tee-worker/app-libs/stf/src/getter.rs
index d2ccec900a..c80cc31fbf 100644
--- a/tee-worker/app-libs/stf/src/getter.rs
+++ b/tee-worker/app-libs/stf/src/getter.rs
@@ -19,7 +19,8 @@ use codec::{Decode, Encode};
use ita_sgx_runtime::{IdentityManagement, System};
use itp_stf_interface::ExecuteGetter;
use itp_stf_primitives::{traits::GetterAuthorization, types::KeyPair};
-use itp_utils::{if_production_or, stringify::account_id_to_string};
+use itp_utils::stringify::account_id_to_string;
+use litentry_macros::if_production_or;
use litentry_primitives::{Identity, LitentryMultiSignature};
use log::*;
use sp_std::vec;
diff --git a/tee-worker/app-libs/stf/src/trusted_call_litentry.rs b/tee-worker/app-libs/stf/src/trusted_call_litentry.rs
index fc286822a5..58b999bef8 100644
--- a/tee-worker/app-libs/stf/src/trusted_call_litentry.rs
+++ b/tee-worker/app-libs/stf/src/trusted_call_litentry.rs
@@ -36,11 +36,12 @@ use itp_node_api::metadata::NodeMetadataTrait;
use itp_node_api_metadata::pallet_imp::IMPCallIndexes;
use itp_node_api_metadata_provider::AccessNodeMetadata;
use itp_types::parentchain::ParentchainCall;
-use itp_utils::{if_production_or, stringify::account_id_to_string};
+use itp_utils::stringify::account_id_to_string;
use lc_stf_task_sender::{
stf_task_sender::{SendStfRequest, StfRequestSender},
AssertionBuildRequest, RequestType, Web2IdentityVerificationRequest,
};
+use litentry_macros::if_production_or;
use litentry_primitives::{
Assertion, ErrorDetail, Identity, RequestAesKey, ValidationData, Web3Network,
};
diff --git a/tee-worker/cli/Cargo.toml b/tee-worker/cli/Cargo.toml
index ec426c6ac2..f3ad923d46 100644
--- a/tee-worker/cli/Cargo.toml
+++ b/tee-worker/cli/Cargo.toml
@@ -53,6 +53,7 @@ lc-credentials = { path = "../litentry/core/credentials" }
# litentry
frame-metadata = "15.0.0"
ita-sgx-runtime = { path = "../app-libs/sgx-runtime" }
+litentry-hex-utils = { path = "../../primitives/hex", default-features = false }
litentry-primitives = { path = "../litentry/primitives" }
my-node-runtime = { package = "rococo-parachain-runtime", path = "../../runtime/rococo" }
pallet-teerex = { path = "../../pallets/teerex", default-features = false }
diff --git a/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc.rs b/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc.rs
index aaf4ac527e..17158a882a 100644
--- a/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc.rs
+++ b/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc.rs
@@ -23,7 +23,7 @@ use crate::{
};
use ita_stf::{trusted_call_result::RequestVCResult, Index, TrustedCall, TrustedCallSigning};
use itp_stf_primitives::types::KeyPair;
-use itp_utils::hex::decode_hex;
+use litentry_hex_utils::decode_hex;
use litentry_primitives::{
aes_decrypt, AchainableAmount, AchainableAmountHolding, AchainableAmountToken,
AchainableAmounts, AchainableBasic, AchainableBetweenPercents, AchainableClassOfYear,
diff --git a/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc_direct.rs b/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc_direct.rs
index 7ac1c81da5..15e5153610 100644
--- a/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc_direct.rs
+++ b/tee-worker/cli/src/trusted_base_cli/commands/litentry/request_vc_direct.rs
@@ -24,7 +24,7 @@ use crate::{
};
use ita_stf::{trusted_call_result::RequestVCResult, Index, TrustedCall, TrustedCallSigning};
use itp_stf_primitives::types::KeyPair;
-use itp_utils::hex::decode_hex;
+use litentry_hex_utils::decode_hex;
use litentry_primitives::{
aes_decrypt, AchainableAmount, AchainableAmountHolding, AchainableAmountToken,
AchainableAmounts, AchainableBasic, AchainableBetweenPercents, AchainableClassOfYear,
diff --git a/tee-worker/core-primitives/utils/Cargo.toml b/tee-worker/core-primitives/utils/Cargo.toml
index 7c293aa011..1e8bd059ae 100644
--- a/tee-worker/core-primitives/utils/Cargo.toml
+++ b/tee-worker/core-primitives/utils/Cargo.toml
@@ -10,6 +10,7 @@ edition = "2021"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
+litentry-hex-utils = { path = "../../../primitives/hex", default-features = false }
[features]
default = ["std"]
diff --git a/tee-worker/core-primitives/utils/src/hex.rs b/tee-worker/core-primitives/utils/src/hex.rs
index 4c167af6f3..3b6ff8a8a8 100644
--- a/tee-worker/core-primitives/utils/src/hex.rs
+++ b/tee-worker/core-primitives/utils/src/hex.rs
@@ -20,8 +20,9 @@
// Todo: merge with hex_display
use crate::error::{Error, Result};
-use alloc::{string::String, vec::Vec};
+use alloc::string::String;
use codec::{Decode, Encode};
+use litentry_hex_utils::{decode_hex, hex_encode};
/// Trait to encode a given value to a hex string, prefixed with "0x".
pub trait ToHexPrefixed {
@@ -45,57 +46,16 @@ impl FromHexPrefixed for T {
type Output = T;
fn from_hex(msg: &str) -> Result {
- let byte_array = decode_hex(msg)?;
+ let byte_array = decode_hex(msg).map_err(Error::Hex)?;
Decode::decode(&mut byte_array.as_slice()).map_err(Error::Codec)
}
}
-/// Hex encodes given data and preappends a "0x".
-pub fn hex_encode(data: &[u8]) -> String {
- let mut hex_str = hex::encode(data);
- hex_str.insert_str(0, "0x");
- hex_str
-}
-
-/// Helper method for decoding hex.
-pub fn decode_hex>(message: T) -> Result> {
- let message = message.as_ref();
- let message = match message {
- [b'0', b'x', hex_value @ ..] => hex_value,
- _ => message,
- };
-
- let decoded_message = hex::decode(message).map_err(Error::Hex)?;
- Ok(decoded_message)
-}
-
#[cfg(test)]
mod tests {
use super::*;
use alloc::string::ToString;
- #[test]
- fn hex_encode_decode_works() {
- let data = "Hello World!".to_string();
-
- let hex_encoded_data = hex_encode(&data.encode());
- let decoded_data =
- String::decode(&mut decode_hex(hex_encoded_data).unwrap().as_slice()).unwrap();
-
- assert_eq!(data, decoded_data);
- }
-
- #[test]
- fn hex_encode_decode_works_empty_input() {
- let data = String::new();
-
- let hex_encoded_data = hex_encode(&data.encode());
- let decoded_data =
- String::decode(&mut decode_hex(hex_encoded_data).unwrap().as_slice()).unwrap();
-
- assert_eq!(data, decoded_data);
- }
-
#[test]
fn hex_encode_decode_works_empty_input_for_decode() {
let data = String::new();
diff --git a/tee-worker/core-primitives/utils/src/lib.rs b/tee-worker/core-primitives/utils/src/lib.rs
index d03767e6c6..297ff5090e 100644
--- a/tee-worker/core-primitives/utils/src/lib.rs
+++ b/tee-worker/core-primitives/utils/src/lib.rs
@@ -25,7 +25,6 @@ pub mod buffer;
pub mod error;
pub mod hex;
pub mod hex_display;
-pub mod macros;
pub mod stringify;
// Public re-exports.
diff --git a/tee-worker/core-primitives/utils/src/macros.rs b/tee-worker/core-primitives/utils/src/macros.rs
deleted file mode 100644
index 9d5234ce50..0000000000
--- a/tee-worker/core-primitives/utils/src/macros.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2020-2024 Trust Computing GmbH.
-// This file is part of Litentry.
-//
-// Litentry is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Litentry 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 General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Litentry. If not, see .
-
-#[macro_export]
-macro_rules! if_production_or {
- ($prod_variant:expr, $non_prod_variant:expr) => {
- if cfg!(feature = "production") {
- $prod_variant
- } else {
- $non_prod_variant
- }
- };
-}
-
-#[macro_export]
-macro_rules! if_not_production {
- ($expression:expr) => {
- if cfg!(not(feature = "production")) {
- $expression
- }
- };
-}
diff --git a/tee-worker/enclave-runtime/Cargo.lock b/tee-worker/enclave-runtime/Cargo.lock
index 1417f0067e..c825310a29 100644
--- a/tee-worker/enclave-runtime/Cargo.lock
+++ b/tee-worker/enclave-runtime/Cargo.lock
@@ -608,8 +608,9 @@ name = "core-primitives"
version = "0.9.12"
dependencies = [
"frame-support",
- "itp-utils",
- "litentry-macros 0.9.12",
+ "litentry-hex-utils",
+ "litentry-macros",
+ "litentry-proc-macros",
"pallet-evm 6.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v0.9.42)",
"parity-scale-codec",
"ring 0.16.20",
@@ -911,8 +912,10 @@ dependencies = [
"lc-scheduled-enclave",
"lc-stf-task-receiver",
"lc-vc-task-receiver",
- "litentry-macros 0.1.0",
+ "litentry-hex-utils",
+ "litentry-macros",
"litentry-primitives",
+ "litentry-proc-macros",
"log",
"multibase",
"once_cell 1.4.0",
@@ -1869,6 +1872,7 @@ dependencies = [
"itp-types",
"itp-utils",
"lc-scheduled-enclave",
+ "litentry-hex-utils",
"litentry-primitives",
"log",
"parity-scale-codec",
@@ -1922,6 +1926,7 @@ dependencies = [
"itp-types",
"itp-utils",
"lc-stf-task-sender",
+ "litentry-macros",
"litentry-primitives",
"log",
"pallet-balances",
@@ -2621,6 +2626,7 @@ name = "itp-utils"
version = "0.9.0"
dependencies = [
"hex 0.4.3",
+ "litentry-hex-utils",
"parity-scale-codec",
]
@@ -2692,6 +2698,7 @@ dependencies = [
"its-state",
"its-validateer-fetch",
"lc-scheduled-enclave",
+ "litentry-hex-utils",
"log",
"parity-scale-codec",
"sgx_tstd",
@@ -2931,6 +2938,7 @@ dependencies = [
"lc-credentials-v2",
"lc-service",
"lc-stf-task-sender",
+ "litentry-hex-utils",
"litentry-primitives",
"log",
"parity-scale-codec",
@@ -3000,6 +3008,7 @@ dependencies = [
"itc-rest-client",
"itp-rpc",
"itp-utils",
+ "litentry-macros",
"litentry-primitives",
"log",
"parity-scale-codec",
@@ -3140,6 +3149,7 @@ dependencies = [
"lc-stf-task-receiver",
"lc-stf-task-sender",
"lc-vc-task-sender",
+ "litentry-macros",
"litentry-primitives",
"log",
"pallet-identity-management-tee",
@@ -3225,21 +3235,15 @@ dependencies = [
]
[[package]]
-name = "litentry-macros"
-version = "0.1.0"
+name = "litentry-hex-utils"
+version = "0.9.12"
dependencies = [
- "cargo_toml",
- "quote 1.0.33",
+ "hex 0.4.3",
]
[[package]]
name = "litentry-macros"
version = "0.9.12"
-dependencies = [
- "proc-macro2",
- "quote 1.0.33",
- "syn 2.0.37",
-]
[[package]]
name = "litentry-primitives"
@@ -3250,6 +3254,7 @@ dependencies = [
"hex 0.4.3",
"itp-sgx-crypto",
"itp-utils",
+ "litentry-hex-utils",
"log",
"pallet-evm 6.0.0-dev (git+https://github.com/integritee-network/frontier.git?branch=bar/polkadot-v0.9.42)",
"parity-scale-codec",
@@ -3268,6 +3273,16 @@ dependencies = [
"teerex-primitives 0.1.0",
]
+[[package]]
+name = "litentry-proc-macros"
+version = "0.9.12"
+dependencies = [
+ "cargo_toml",
+ "proc-macro2",
+ "quote 1.0.33",
+ "syn 2.0.37",
+]
+
[[package]]
name = "log"
version = "0.4.17"
diff --git a/tee-worker/enclave-runtime/Cargo.toml b/tee-worker/enclave-runtime/Cargo.toml
index b828f44e72..cad156a51b 100644
--- a/tee-worker/enclave-runtime/Cargo.toml
+++ b/tee-worker/enclave-runtime/Cargo.toml
@@ -137,8 +137,10 @@ lc-data-providers = { path = "../litentry/core/data-providers", default-features
lc-scheduled-enclave = { path = "../litentry/core/scheduled-enclave", default-features = false, features = ["sgx"] }
lc-stf-task-receiver = { path = "../litentry/core/stf-task/receiver", default-features = false, features = ["sgx"] }
lc-vc-task-receiver = { path = "../litentry/core/vc-issuance/lc-vc-task-receiver", default-features = false, features = ["sgx"] }
-litentry-macros = { path = "../litentry/macros" }
+litentry-hex-utils = { path = "../../primitives/hex", default-features = false }
+litentry-macros = { path = "../../primitives/core/macros", default-features = false }
litentry-primitives = { path = "../litentry/primitives", default-features = false, features = ["sgx"] }
+litentry-proc-macros = { path = "../../primitives/core/proc-macros", default-features = false }
# substrate deps
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
diff --git a/tee-worker/enclave-runtime/src/lib.rs b/tee-worker/enclave-runtime/src/lib.rs
index 9c3b078558..208dcb50f5 100644
--- a/tee-worker/enclave-runtime/src/lib.rs
+++ b/tee-worker/enclave-runtime/src/lib.rs
@@ -75,7 +75,8 @@ use itp_settings::worker_mode::{ProvideWorkerMode, WorkerMode, WorkerModeProvide
use itp_sgx_crypto::key_repository::AccessPubkey;
use itp_storage::{StorageProof, StorageProofChecker};
use itp_types::{ShardIdentifier, SignedBlock};
-use itp_utils::{if_production_or, write_slice_and_whitespace_pad};
+use itp_utils::write_slice_and_whitespace_pad;
+use litentry_macros::if_production_or;
use log::*;
use once_cell::sync::OnceCell;
use sgx_types::sgx_status_t;
@@ -133,7 +134,7 @@ pub unsafe extern "C" fn init(
// Initialize the logging environment in the enclave.
if_production_or!(
{
- let module_names = litentry_macros::local_modules!();
+ let module_names = litentry_proc_macros::local_modules!();
println!(
"Initializing logger to filter only following local modules: {:?}",
module_names
diff --git a/tee-worker/enclave-runtime/src/rpc/worker_api_direct.rs b/tee-worker/enclave-runtime/src/rpc/worker_api_direct.rs
index 4133bccca6..802107c544 100644
--- a/tee-worker/enclave-runtime/src/rpc/worker_api_direct.rs
+++ b/tee-worker/enclave-runtime/src/rpc/worker_api_direct.rs
@@ -45,13 +45,14 @@ use itp_top_pool_author::traits::AuthorApi;
use itp_types::{
DirectRequestStatus, Index, MrEnclave, RsaRequest, ShardIdentifier, SidechainBlockNumber, H256,
};
-use itp_utils::{if_not_production, FromHexPrefixed, ToHexPrefixed};
+use itp_utils::{FromHexPrefixed, ToHexPrefixed};
use its_primitives::types::block::SignedBlock;
use its_sidechain::rpc_handler::{
direct_top_pool_api, direct_top_pool_api::decode_shard_from_base58, import_block_api,
};
use jsonrpc_core::{serde_json::json, IoHandler, Params, Value};
use lc_scheduled_enclave::{ScheduledEnclaveUpdater, GLOBAL_SCHEDULED_ENCLAVE};
+use litentry_macros::if_not_production;
use litentry_primitives::DecryptableRequest;
use log::debug;
use sgx_crypto_helper::rsa3072::Rsa3072PubKey;
@@ -489,7 +490,7 @@ fn forward_dcap_quote_inner(params: Params) -> Result {
let param = &hex_encoded_params.get(0).ok_or("Could not get first param")?;
let encoded_quote_to_forward: Vec =
- itp_utils::hex::decode_hex(param).map_err(|e| format!("{:?}", e))?;
+ litentry_hex_utils::decode_hex(param).map_err(|e| format!("{:?}", e))?;
let url = String::new();
let ext = generate_dcap_ra_extrinsic_from_quote_internal(url, &encoded_quote_to_forward)
@@ -519,7 +520,7 @@ fn attesteer_forward_ias_attestation_report_inner(
let param = &hex_encoded_params.get(0).ok_or("Could not get first param")?;
let ias_attestation_report =
- itp_utils::hex::decode_hex(param).map_err(|e| format!("{:?}", e))?;
+ litentry_hex_utils::decode_hex(param).map_err(|e| format!("{:?}", e))?;
let url = String::new();
let ext = generate_ias_ra_extrinsic_from_der_cert_internal(url, &ias_attestation_report)
diff --git a/tee-worker/enclave-runtime/src/top_pool_execution.rs b/tee-worker/enclave-runtime/src/top_pool_execution.rs
index a8168864e3..060bb54d60 100644
--- a/tee-worker/enclave-runtime/src/top_pool_execution.rs
+++ b/tee-worker/enclave-runtime/src/top_pool_execution.rs
@@ -55,7 +55,6 @@ use itp_sgx_externalities::SgxExternalities;
use itp_stf_state_handler::{handle_state::HandleState, query_shard_state::QueryShardState};
use itp_time_utils::duration_now;
use itp_types::{parentchain::ParentchainCall, Block, OpaqueCall, H256};
-use itp_utils::if_not_production;
use its_primitives::{
traits::{
Block as SidechainBlockTrait, Header as HeaderTrait, ShardIdentifierFor, SignedBlock,
@@ -69,6 +68,7 @@ use its_sidechain::{
validateer_fetch::ValidateerFetch,
};
use lc_scheduled_enclave::{ScheduledEnclaveUpdater, GLOBAL_SCHEDULED_ENCLAVE};
+use litentry_macros::if_not_production;
use log::*;
use sgx_types::sgx_status_t;
use sp_core::{crypto::UncheckedFrom, Pair};
diff --git a/tee-worker/litentry/core/assertion-build-v2/Cargo.toml b/tee-worker/litentry/core/assertion-build-v2/Cargo.toml
index 7a9380d09b..3451c85a06 100644
--- a/tee-worker/litentry/core/assertion-build-v2/Cargo.toml
+++ b/tee-worker/litentry/core/assertion-build-v2/Cargo.toml
@@ -31,6 +31,7 @@ lc-common = { path = "../common", default-features = false }
lc-credentials-v2 = { path = "../credentials-v2", default-features = false }
lc-service = { path = "../service", default-features = false }
lc-stf-task-sender = { path = "../stf-task/sender", default-features = false }
+litentry-hex-utils = { path = "../../../../primitives/hex", default-features = false }
litentry-primitives = { path = "../../primitives", default-features = false }
[dev-dependencies]
diff --git a/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs b/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs
index 2cae98d3ac..4973ce5ecf 100644
--- a/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs
+++ b/tee-worker/litentry/core/assertion-build-v2/src/token_holding_amount/mod.rs
@@ -76,10 +76,10 @@ mod tests {
use super::*;
use itp_stf_primitives::types::ShardIdentifier;
use itp_types::AccountId;
- use itp_utils::hex::decode_hex;
use lc_common::web3_token::{TokenAddress, TokenName};
use lc_credentials_v2::assertion_logic::{AssertionLogic, Op};
use lc_mock_server::run;
+ use litentry_hex_utils::decode_hex;
use litentry_primitives::{Identity, IdentityNetworkTuple};
fn crate_assertion_build_request(
diff --git a/tee-worker/litentry/core/assertion-build/Cargo.toml b/tee-worker/litentry/core/assertion-build/Cargo.toml
index f23f8835bf..63b5a54ac6 100644
--- a/tee-worker/litentry/core/assertion-build/Cargo.toml
+++ b/tee-worker/litentry/core/assertion-build/Cargo.toml
@@ -52,6 +52,7 @@ pallet-parachain-staking = { path = "../../../../pallets/parachain-staking", def
[dev-dependencies]
env_logger = "0.10.0"
lc-mock-server = { path = "../mock-server" }
+litentry-hex-utils = { path = "../../../../primitives/hex" }
[features]
default = ["std"]
diff --git a/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs b/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs
index 7fb7a8de2b..70715e0770 100644
--- a/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs
+++ b/tee-worker/litentry/core/assertion-build/src/nodereal/amount_holding/evm_amount_holding.rs
@@ -123,9 +123,9 @@ pub fn build(
mod tests {
use super::*;
use itp_stf_primitives::types::ShardIdentifier;
- use itp_utils::hex::decode_hex;
use lc_credentials::assertion_logic::{AssertionLogic, Op};
use lc_mock_server::run;
+ use litentry_hex_utils::decode_hex;
fn create_ton_token_assertion_logic() -> Box {
Box::new(AssertionLogic::Item { src: "$token".into(), op: Op::Equal, dst: "TON".into() })
diff --git a/tee-worker/litentry/core/data-providers/Cargo.toml b/tee-worker/litentry/core/data-providers/Cargo.toml
index 6eca7cb2b3..7e97240746 100644
--- a/tee-worker/litentry/core/data-providers/Cargo.toml
+++ b/tee-worker/litentry/core/data-providers/Cargo.toml
@@ -34,6 +34,7 @@ thiserror_sgx = { package = "thiserror", git = "https://github.com/mesalock-linu
url_sgx = { package = "url", git = "https://github.com/mesalock-linux/rust-url-sgx", tag = "sgx_1.1.3", optional = true }
# litentry
+litentry-macros = { path = "../../../../primitives/core/macros", default-features = false }
litentry-primitives = { path = "../../primitives", default-features = false }
[dev-dependencies]
diff --git a/tee-worker/litentry/core/data-providers/src/lib.rs b/tee-worker/litentry/core/data-providers/src/lib.rs
index ce252983e0..afcfb02676 100644
--- a/tee-worker/litentry/core/data-providers/src/lib.rs
+++ b/tee-worker/litentry/core/data-providers/src/lib.rs
@@ -44,7 +44,7 @@ use itc_rest_client::{
http_client::{DefaultSend, HttpClient},
rest_client::RestClient,
};
-use itp_utils::if_not_production;
+use litentry_macros::if_not_production;
use log::debug;
use serde::{Deserialize, Serialize};
use std::vec;
diff --git a/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/Cargo.toml b/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/Cargo.toml
index 609185f601..e7640939fc 100644
--- a/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/Cargo.toml
+++ b/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/Cargo.toml
@@ -44,6 +44,7 @@ lc-data-providers = { path = "../../data-providers", default-features = false }
lc-stf-task-receiver = { path = "../../stf-task/receiver", default-features = false }
lc-stf-task-sender = { path = "../../stf-task/sender", default-features = false }
lc-vc-task-sender = { path = "../lc-vc-task-sender", default-features = false }
+litentry-macros = { path = "../../../../../primitives/core/macros", default-features = false }
litentry-primitives = { path = "../../../primitives", default-features = false }
pallet-identity-management-tee = { path = "../../../pallets/identity-management", default-features = false }
diff --git a/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/src/lib.rs b/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/src/lib.rs
index 28ce33d4bf..64ca0225b2 100644
--- a/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/src/lib.rs
+++ b/tee-worker/litentry/core/vc-issuance/lc-vc-task-receiver/src/lib.rs
@@ -41,10 +41,10 @@ use itp_top_pool_author::traits::AuthorApi;
use itp_types::{
parentchain::ParentchainId, AccountId, BlockNumber as SidechainBlockNumber, ShardIdentifier,
};
-use itp_utils::if_production_or;
use lc_stf_task_receiver::StfTaskContext;
use lc_stf_task_sender::AssertionBuildRequest;
use lc_vc_task_sender::init_vc_task_sender_storage;
+use litentry_macros::if_production_or;
use litentry_primitives::{
AesRequest, Assertion, DecryptableRequest, Identity, ParentchainBlockNumber,
};
diff --git a/tee-worker/litentry/macros/Cargo.toml b/tee-worker/litentry/macros/Cargo.toml
deleted file mode 100644
index c3039927e1..0000000000
--- a/tee-worker/litentry/macros/Cargo.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-[package]
-authors = ["Trust Computing GmbH "]
-name = "litentry-macros"
-version = "0.1.0"
-edition = "2021"
-
-[dependencies]
-cargo_toml = "0.16.3"
-quote = "1.0.33"
-
-[lib]
-proc-macro = true
diff --git a/tee-worker/litentry/primitives/Cargo.toml b/tee-worker/litentry/primitives/Cargo.toml
index 2ad014ae67..b57c4e5b20 100644
--- a/tee-worker/litentry/primitives/Cargo.toml
+++ b/tee-worker/litentry/primitives/Cargo.toml
@@ -30,6 +30,7 @@ sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git", branch = "m
# internal dependencies
itp-sgx-crypto = { path = "../../core-primitives/sgx/crypto", default-features = false }
itp-utils = { path = "../../core-primitives/utils", default-features = false }
+litentry-hex-utils = { path = "../../../primitives/hex", default-features = false }
parentchain-primitives = { package = "core-primitives", path = "../../../primitives/core", default-features = false }
teerex-primitives = { path = "../../../primitives/teerex", default-features = false }
diff --git a/tee-worker/litentry/primitives/src/lib.rs b/tee-worker/litentry/primitives/src/lib.rs
index 4bf0e4c6c1..4978ee7369 100644
--- a/tee-worker/litentry/primitives/src/lib.rs
+++ b/tee-worker/litentry/primitives/src/lib.rs
@@ -41,7 +41,7 @@ pub use validation_data::*;
use bitcoin::sign_message::{signed_msg_hash, MessageSignature};
use codec::{Decode, Encode, MaxEncodedLen};
use itp_sgx_crypto::ShieldingCryptoDecrypt;
-use itp_utils::hex::hex_encode;
+use litentry_hex_utils::hex_encode;
use log::error;
pub use parentchain_primitives::{
all_bitcoin_web3networks, all_evm_web3networks, all_substrate_web3networks, all_web3networks,
diff --git a/tee-worker/service/Cargo.toml b/tee-worker/service/Cargo.toml
index c751b43e50..207628ffd3 100644
--- a/tee-worker/service/Cargo.toml
+++ b/tee-worker/service/Cargo.toml
@@ -74,6 +74,8 @@ ita-stf = { path = "../app-libs/stf", default-features = false }
lc-data-providers = { path = "../litentry/core/data-providers" }
lc-mock-server = { path = "../litentry/core/mock-server" }
lc-stf-task-sender = { path = "../litentry/core/stf-task/sender", default-features = false }
+litentry-hex-utils = { path = "../../primitives/hex", default-features = false }
+litentry-macros = { path = "../../primitives/core/macros", default-features = false }
litentry-primitives = { path = "../litentry/primitives" }
my-node-runtime = { package = "rococo-parachain-runtime", path = "../../runtime/rococo" }
sgx-verify = { path = "../../pallets/teerex/sgx-verify", default-features = false }
diff --git a/tee-worker/service/src/main_impl.rs b/tee-worker/service/src/main_impl.rs
index a211d214f5..bba89601df 100644
--- a/tee-worker/service/src/main_impl.rs
+++ b/tee-worker/service/src/main_impl.rs
@@ -44,13 +44,13 @@ use itp_node_api::{
node_api_factory::{CreateNodeApi, NodeApiFactory},
};
use itp_settings::worker_mode::{ProvideWorkerMode, WorkerMode, WorkerModeProvider};
-use itp_utils::if_production_or;
use its_peer_fetch::{
block_fetch_client::BlockFetcher, untrusted_peer_fetch::UntrustedPeerFetcher,
};
use its_primitives::types::block::SignedBlock as SignedSidechainBlock;
use its_storage::{interface::FetchBlocks, BlockPruner, SidechainStorageLock};
use lc_data_providers::DataProviderConfig;
+use litentry_macros::if_production_or;
use log::*;
use my_node_runtime::{Hash, Header, RuntimeEvent};
use regex::Regex;
diff --git a/tee-worker/service/src/teeracle/mod.rs b/tee-worker/service/src/teeracle/mod.rs
index 420a175b26..415f7c461d 100644
--- a/tee-worker/service/src/teeracle/mod.rs
+++ b/tee-worker/service/src/teeracle/mod.rs
@@ -20,7 +20,7 @@ use codec::{Decode, Encode};
use itp_enclave_api::teeracle_api::TeeracleApi;
use itp_node_api::api_client::ParentchainApi;
use itp_types::parentchain::Hash;
-use itp_utils::hex::hex_encode;
+use litentry_hex_utils::hex_encode;
use log::*;
use sp_runtime::OpaqueExtrinsic;
use std::time::Duration;
diff --git a/tee-worker/sidechain/consensus/aura/Cargo.toml b/tee-worker/sidechain/consensus/aura/Cargo.toml
index a7a52de35e..edb3ed9916 100644
--- a/tee-worker/sidechain/consensus/aura/Cargo.toml
+++ b/tee-worker/sidechain/consensus/aura/Cargo.toml
@@ -42,6 +42,7 @@ its-validateer-fetch = { path = "../../validateer-fetch", default-features = fal
# litentry
itp-utils = { path = "../../../core-primitives/utils", default-features = false }
lc-scheduled-enclave = { path = "../../../litentry/core/scheduled-enclave", default-features = false }
+litentry-hex-utils = { path = "../../../../primitives/hex", default-features = false }
[dev-dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
diff --git a/tee-worker/sidechain/consensus/aura/src/lib.rs b/tee-worker/sidechain/consensus/aura/src/lib.rs
index 193eb0501c..dbbe099e4e 100644
--- a/tee-worker/sidechain/consensus/aura/src/lib.rs
+++ b/tee-worker/sidechain/consensus/aura/src/lib.rs
@@ -37,7 +37,6 @@ use itp_sgx_externalities::SgxExternalities;
use itp_stf_state_handler::handle_state::HandleState;
use itp_time_utils::duration_now;
-use itp_utils::hex::hex_encode;
use its_block_verification::slot::slot_author;
use its_consensus_common::{Environment, Error as ConsensusError, Proposer};
use its_consensus_slots::{SimpleSlotWorker, Slot, SlotInfo};
@@ -47,6 +46,7 @@ use its_primitives::{
};
use its_validateer_fetch::ValidateerFetch;
use lc_scheduled_enclave::ScheduledEnclaveUpdater;
+use litentry_hex_utils::hex_encode;
use sp_core::ByteArray;
use sp_runtime::{
app_crypto::{sp_core::H256, Pair},