Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
858110f
adjust docker tag for tee-dev
Kailai-Wang Jul 5, 2022
6924130
Merge branch 'dev' into tee-dev
Kailai-Wang Jul 5, 2022
2a3269b
Merge branch 'dev' into tee-dev
Kailai-Wang Jul 11, 2022
6a38e62
use integritee/pallets master branch
Kailai-Wang Jul 22, 2022
69a45a8
Merge remote-tracking branch 'origin/dev' into tee-dev
Aug 4, 2022
e22fc37
Merge remote-tracking branch 'origin/dev' into tee-dev
Aug 5, 2022
ce0c5c9
Merge branch 'dev' into tee-dev
Kailai-Wang Aug 17, 2022
25e4b11
add teeracle to tee-dev
Kailai-Wang Aug 17, 2022
848c967
Merge branch 'dev' into tee-dev
Kailai-Wang Aug 17, 2022
a5258b3
Merge remote-tracking branch 'origin/dev' into tee-dev
Aug 23, 2022
9d9fb38
Merge remote-tracking branch 'origin/dev' into tee-dev
Aug 24, 2022
0d1d828
switch to sdk-v0.9.0-polkadot-v0.9.26 as release branch
Kailai-Wang Aug 28, 2022
79c9a25
Merge branch 'tee-dev' of github.com:litentry/litentry-parachain into…
Aug 31, 2022
a7d1c94
Merge remote-tracking branch 'origin/dev' into tee-dev
Aug 31, 2022
8b35b6f
add back the dummy method for testing purpose
Aug 31, 2022
c35e460
fix make clippy
Aug 31, 2022
3d3958d
Merge branch 'dev' into tee-dev
Kailai-Wang Sep 19, 2022
a81ccc6
small cleanup
Kailai-Wang Sep 19, 2022
5902a19
add back teeracle
Kailai-Wang Sep 19, 2022
a8a2475
Merge branch 'dev' into tee-dev
Kailai-Wang Sep 23, 2022
2a9cbb8
Merge branch 'dev' into tee-dev
Kailai-Wang Oct 5, 2022
d621d1d
use specific branch of tee-primitives (todo:revert it)
Kailai-Wang Oct 5, 2022
3031343
correctify branch for tee-primitives
Kailai-Wang Oct 8, 2022
0804daa
Merge branch 'dev' into tee-dev
Kailai-Wang Oct 13, 2022
3740e49
temporarily use TEE pallets master branch
Kailai-Wang Oct 15, 2022
b3d10d2
add EnsureOrigin impl and tests
Kailai-Wang Oct 16, 2022
3fd9578
its better to place it in runtime_common
Kailai-Wang Oct 16, 2022
f77fc8b
Merge branch '895-use-real-enclave-signer' into tee-dev
Kailai-Wang Oct 16, 2022
fd4d119
Merge branch 'dev' into tee-dev
Kailai-Wang Oct 17, 2022
32766da
remove the dummy extrinsic (used for testing previous)
Oct 18, 2022
784cc04
rename ruleset -> assertion
Oct 20, 2022
c45e714
update renaming
Oct 20, 2022
fc63594
revert balance type
Oct 20, 2022
3049ef8
according to upstream, update pallets branch to 'develop'
Nov 1, 2022
968c4c3
fix build error
Nov 1, 2022
4890717
add rococo docker file
Nov 2, 2022
59b698f
Cherry-Pick: 47386434
Kailai-Wang Oct 26, 2022
c76adde
Update tee-dev branch into polkadot v0.9.29 (#971)
BillyWooo Nov 23, 2022
469f769
add BUILDKIT explicitly
Nov 24, 2022
b6dda59
Merge tee worker repo (#987)
Kailai-Wang Nov 29, 2022
ae6d19b
add graphql data provider for data query
BillyWooo Nov 29, 2022
f85a91b
Switch to local dependencies (#1037)
Kailai-Wang Nov 30, 2022
c3e869e
Merge remote-tracking branch 'origin/tee-dev' into graphql_data_provider
BillyWooo Nov 30, 2022
09784f1
Try to fix the docker image pushing (#1040)
Kailai-Wang Nov 30, 2022
0b1d286
remove unneeded CI steps (#1049)
Kailai-Wang Dec 1, 2022
5041960
tee-worker ts-tests (#1039)
0xverin Dec 2, 2022
90f237b
add multiconfig for launch workers with local development / staging e…
BillyWooo Dec 4, 2022
084dbf3
Ts tests (#1053)
0xverin Dec 5, 2022
4435974
add comment
BillyWooo Dec 5, 2022
1c6980e
Add more testcases for IMP mock (#1057)
Kailai-Wang Dec 5, 2022
c485920
982 renaming issue (#1052)
BillyWooo Dec 6, 2022
18825b6
Merge branch 'tee-dev' into 1000_muti_config_to_launch_workers
Dec 6, 2022
4fd2ace
Merge branch 'tee-dev' into graphql_data_provider
jingleizhang Dec 6, 2022
74965e6
Merge branch '1000_muti_config_to_launch_workers' of github.com:liten…
BillyWooo Dec 6, 2022
8d833d4
move hardcode const to input parameter
BillyWooo Dec 7, 2022
e6f4808
make clippy happy
BillyWooo Dec 7, 2022
d4a9f58
link web3 and verify web3 (#1072)
0xverin Dec 8, 2022
b734572
Emit new challenge code for each `create_identity` (#1074)
Kailai-Wang Dec 8, 2022
2574c9d
Merge branch 'tee-dev' into 1000_muti_config_to_launch_workers
jingleizhang Dec 12, 2022
cc55ce7
Return encrypted IDGraph when changed (#1080)
Kailai-Wang Dec 12, 2022
0fb10bf
Merge remote-tracking branch 'origin/tee-dev' into 1000_muti_config_t…
BillyWooo Dec 14, 2022
d5ac04d
Merge remote-tracking branch 'origin/tee-dev' into graphql_data_provider
BillyWooo Dec 14, 2022
ead95ac
Tee worker polkadot v0.9.32 (#1093)
BillyWooo Dec 15, 2022
e578eea
Merge remote-tracking branch 'origin/dev' into tee-dev
BillyWooo Dec 15, 2022
6305908
update tee worker ci
BillyWooo Dec 15, 2022
a3057c6
Merge remote-tracking branch 'origin/tee-dev' into 1000_muti_config_t…
BillyWooo Dec 15, 2022
4269556
Merge remote-tracking branch 'origin/dev' into 1000_muti_config_to_la…
BillyWooo Dec 15, 2022
5337481
refactor terminal parameter into json config file
BillyWooo Dec 18, 2022
ef81204
update dependency version
BillyWooo Dec 18, 2022
0b563c4
Merge remote-tracking branch 'origin/tee-dev' into graphql_data_provider
BillyWooo Dec 18, 2022
2a195c6
Merge remote-tracking branch 'origin/dev' into graphql_data_provider
BillyWooo Dec 18, 2022
c68d91e
rm not used files
BillyWooo Dec 18, 2022
87b931a
Merge branch '1000_muti_config_to_launch_workers' into graphql_data_p…
BillyWooo Dec 18, 2022
6b55eba
cargo update & update global variable
BillyWooo Dec 19, 2022
08d15bf
fix path
BillyWooo Dec 19, 2022
89a3455
Merge branch '1000_muti_config_to_launch_workers' into graphql_data_p…
BillyWooo Dec 19, 2022
b4d8c88
refactor code with new graphql API example
BillyWooo Dec 19, 2022
e3b9555
Merge branch 'dev' into graphql_data_provider
BillyWooo Dec 20, 2022
dfc5456
merge assertion4 and assertion12: both query LIT; cleanup code;
BillyWooo Dec 20, 2022
c2a2ed9
Merge remote-tracking branch 'origin/dev' into graphql_data_provider
BillyWooo Dec 20, 2022
309fa79
Merge branch 'dev' into graphql_data_provider
jingleizhang Dec 21, 2022
6b2f46c
Merge branch 'dev' into graphql_data_provider
Kailai-Wang Dec 21, 2022
4067bb0
Merge branch 'dev' into graphql_data_provider
Kailai-Wang Dec 21, 2022
7e87940
Merge remote-tracking branch 'origin/dev' into graphql_data_provider
BillyWooo Dec 22, 2022
ec5aa92
update based on PR comments
BillyWooo Dec 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pallets/vc-management/src/assertion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ pub enum Assertion {
A1,
A2(ParameterString, ParameterString), // (guild_id, user_id)
A3(ParameterString, ParameterString), // (guild_id, user_id)
A4,
A4(Balance, ParameterString), // (LIT_amount, timestamp, e.g.: 2022-10-16T00:00:00Z)
A5(ParameterString, ParameterString), // (twitter_account, tweet_id)
A6,
A7(Balance, u32), // (DOT_amount, year)
A8(u64), // (tx_amount)
A9,
A10(Balance, u32), // (WBTC_amount, year)
A11(Balance, u32), // (ETH_amount, year)
A12(Balance, u32), // (LIT_amount, year)
A13(u32), // (Karma_amount) - TODO: unsupported
}
3 changes: 3 additions & 0 deletions tee-worker/Cargo.lock

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

1 change: 1 addition & 0 deletions tee-worker/enclave-runtime/Cargo.lock

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

2 changes: 1 addition & 1 deletion tee-worker/litentry/core/assertion-build/src/a3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn build(guild_id: ParameterString, handler: ParameterString) -> Result<()>
let mut client = DiscordLitentryClient::new();
match client.check_id_hubber(guild_id.into_inner(), handler.into_inner()) {
Err(e) => {
log::error!("error build assertion2: {:?}", e);
log::error!("error build assertion3: {:?}", e);
Err(Error::Assertion3Error(format!("{:?}", e)))
},
Ok(_response) => {
Expand Down
99 changes: 99 additions & 0 deletions tee-worker/litentry/core/assertion-build/src/a4.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright 2020-2022 Litentry Technologies 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 <https://www.gnu.org/licenses/>.

#[cfg(all(feature = "std", feature = "sgx"))]
compile_error!("feature \"std\" and feature \"sgx\" cannot be enabled at the same time");

#[cfg(all(not(feature = "std"), feature = "sgx"))]
extern crate sgx_tstd as std;

use crate::{Error, Result};
use std::{
str::from_utf8,
string::{String, ToString},
vec,
vec::Vec,
};

use lc_stf_task_sender::MaxIdentityLength;
use litentry_primitives::{
EvmNetwork, Identity, IdentityHandle, IdentityWebType, SubstrateNetwork, Web3Network,
};
use sp_runtime::BoundedVec;

use lc_data_providers::graphql::{
GraphQLClient, VerifiedCredentialsIsHodlerIn, VerifiedCredentialsNetwork,
};

// ERC20 LIT token address
const LIT_TOKEN_ADDRESS: &str = "0xb59490aB09A0f526Cc7305822aC65f2Ab12f9723";

pub fn build(
identities: BoundedVec<Identity, MaxIdentityLength>,
from_date: String,
min_balance: f64,
) -> Result<()> {
let mut client = GraphQLClient::new();

for identity in identities {
let mut network = VerifiedCredentialsNetwork::Polkadot;
if let IdentityWebType::Web3(web3_type) = identity.web_type {
match web3_type {
Web3Network::Substrate(SubstrateNetwork::Litentry) =>
network = VerifiedCredentialsNetwork::Litentry,
Web3Network::Substrate(SubstrateNetwork::Litmus) =>
network = VerifiedCredentialsNetwork::Litmus,
Web3Network::Evm(EvmNetwork::Ethereum) =>
network = VerifiedCredentialsNetwork::Ethereum,
_ => (),
}
};

if network == VerifiedCredentialsNetwork::Litentry
|| network == VerifiedCredentialsNetwork::Litmus
|| network == VerifiedCredentialsNetwork::Ethereum
{
let mut addresses: Vec<String> = vec![];
match identity.handle {
IdentityHandle::Address20(addr) =>
addresses.push(from_utf8(&addr).unwrap().to_string()),
IdentityHandle::Address32(addr) =>
addresses.push(from_utf8(&addr).unwrap().to_string()),
IdentityHandle::String(addr) =>
addresses.push(from_utf8(&addr).unwrap().to_string()),
}
let mut tmp_token_addr = String::from("");
if network == VerifiedCredentialsNetwork::Ethereum {
tmp_token_addr = LIT_TOKEN_ADDRESS.to_string();
}
let credentials = VerifiedCredentialsIsHodlerIn {
addresses,
from_date: from_date.clone(),
network,
token_address: tmp_token_addr,
min_balance,
};
let is_hodler_out = client.check_verified_credentials_is_hodler(credentials);
if let Ok(_hodler_out) = is_hodler_out {
// TODO: generate VC

return Ok(())
}
}
}

Err(Error::Assertion4Error("no valid response".to_string()))
}
78 changes: 78 additions & 0 deletions tee-worker/litentry/core/assertion-build/src/a7.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Copyright 2020-2022 Litentry Technologies 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 <https://www.gnu.org/licenses/>.

#[cfg(all(feature = "std", feature = "sgx"))]
compile_error!("feature \"std\" and feature \"sgx\" cannot be enabled at the same time");

#[cfg(all(not(feature = "std"), feature = "sgx"))]
extern crate sgx_tstd as std;

use crate::{Error, Result};
use std::{
str::from_utf8,
string::{String, ToString},
vec,
vec::Vec,
};

use lc_stf_task_sender::MaxIdentityLength;
use litentry_primitives::{
Identity, IdentityHandle, IdentityWebType, SubstrateNetwork, Web3Network,
};
use sp_runtime::BoundedVec;

use lc_data_providers::graphql::{
GraphQLClient, VerifiedCredentialsIsHodlerIn, VerifiedCredentialsNetwork,
};

pub fn build(
identities: BoundedVec<Identity, MaxIdentityLength>,
from_date: String,
min_balance: f64,
) -> Result<()> {
let mut client = GraphQLClient::new();

for identity in identities {
if let IdentityWebType::Web3(Web3Network::Substrate(SubstrateNetwork::Polkadot)) =
identity.web_type
{
let mut addresses: Vec<String> = vec![];
match identity.handle {
IdentityHandle::Address20(addr) =>
addresses.push(from_utf8(&addr).unwrap().to_string()),
IdentityHandle::Address32(addr) =>
addresses.push(from_utf8(&addr).unwrap().to_string()),
IdentityHandle::String(addr) =>
addresses.push(from_utf8(&addr).unwrap().to_string()),
}
let credentials = VerifiedCredentialsIsHodlerIn {
addresses,
from_date: from_date.clone(),
network: VerifiedCredentialsNetwork::Polkadot,
token_address: String::from(""),
min_balance,
};
let is_hodler_out = client.check_verified_credentials_is_hodler(credentials);
if let Ok(_hodler_out) = is_hodler_out {
// TODO: generate VC

return Ok(())
}
}
}

Err(Error::Assertion7Error("no valid response".to_string()))
}
8 changes: 8 additions & 0 deletions tee-worker/litentry/core/assertion-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ use std::{fmt::Debug, string::String};
pub mod a1;
pub mod a2;
pub mod a3;
pub mod a4;
pub mod a5;
pub mod a6;
pub mod a7;

pub type Result<T> = core::result::Result<T, Error>;

Expand All @@ -53,9 +55,15 @@ pub enum Error {
#[error("Assertion3 error: {0}")]
Assertion3Error(String),

#[error("Assertion4 error: {0}")]
Assertion4Error(String),

#[error("Assertion5 error: {0}")]
Assertion5Error(String),

#[error("Assertion7 error: {0}")]
Assertion7Error(String),

#[error("Other error: {0}")]
AssertionOtherError(String),
}
2 changes: 1 addition & 1 deletion tee-worker/litentry/core/data-providers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ litentry-primitives = { path = "../../primitives", default-features = false }
httpmock = "0.6"
lc-mock-server = { path = "../mock-server" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.32", default-features = false }

chrono = { version = "0.4.23" }

[features]
default = ["std"]
Expand Down
Loading