From ef2a58fe399718e31f803d137a04cf488e517606 Mon Sep 17 00:00:00 2001 From: Kasper Ziemianek Date: Tue, 25 Jul 2023 08:56:32 +0200 Subject: [PATCH] remove VC subject tag field (#1940) --- tee-worker/litentry/core/assertion-build/src/a1.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a10.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a11.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a13.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a14.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a2.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a3.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a4.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a6.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a7.rs | 7 +------ tee-worker/litentry/core/assertion-build/src/a8.rs | 8 +------- tee-worker/litentry/core/credentials/src/lib.rs | 7 +------ .../core/credentials/src/templates/credential.json | 3 --- .../core/credentials/src/templates/credential_schema.json | 3 --- 14 files changed, 12 insertions(+), 79 deletions(-) diff --git a/tee-worker/litentry/core/assertion-build/src/a1.rs b/tee-worker/litentry/core/assertion-build/src/a1.rs index 42e3e1975c..e8385f9d25 100644 --- a/tee-worker/litentry/core/assertion-build/src/a1.rs +++ b/tee-worker/litentry/core/assertion-build/src/a1.rs @@ -25,7 +25,6 @@ use crate::*; const VC_A1_SUBJECT_DESCRIPTION: &str = "The user has verified one identity in Web 2 and one identity in Web 3"; const VC_A1_SUBJECT_TYPE: &str = "Basic Identity Verification"; -const VC_A1_SUBJECT_TAG: [&str; 1] = ["Litentry Network"]; pub fn build(req: &AssertionBuildRequest) -> Result { debug!("Assertion A1 build, who: {:?}", account_id_to_string(&req.who)); @@ -44,11 +43,7 @@ pub fn build(req: &AssertionBuildRequest) -> Result { match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { // add subject info - credential_unsigned.add_subject_info( - VC_A1_SUBJECT_DESCRIPTION, - VC_A1_SUBJECT_TYPE, - VC_A1_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A1_SUBJECT_DESCRIPTION, VC_A1_SUBJECT_TYPE); // add assertion let flag = web2_cnt != 0 && web3_cnt != 0; diff --git a/tee-worker/litentry/core/assertion-build/src/a10.rs b/tee-worker/litentry/core/assertion-build/src/a10.rs index 5fda1f536d..81bd68403c 100644 --- a/tee-worker/litentry/core/assertion-build/src/a10.rs +++ b/tee-worker/litentry/core/assertion-build/src/a10.rs @@ -32,7 +32,6 @@ use lc_data_providers::{ const VC_A10_SUBJECT_DESCRIPTION: &str = "The user has been consistently holding at least {x} amount of tokens before 2023 Jan 1st 00:00:00 UTC on the supporting networks"; const VC_A10_SUBJECT_TYPE: &str = "WBTC Holding Assertion"; -const VC_A10_SUBJECT_TAG: [&str; 1] = ["Ethereum"]; // WBTC Holder // TODO: @@ -74,11 +73,7 @@ pub fn build(req: &AssertionBuildRequest, min_balance: ParameterString) -> Resul match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { - credential_unsigned.add_subject_info( - VC_A10_SUBJECT_DESCRIPTION, - VC_A10_SUBJECT_TYPE, - VC_A10_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A10_SUBJECT_DESCRIPTION, VC_A10_SUBJECT_TYPE); credential_unsigned.update_holder( is_hold, &q_min_balance, diff --git a/tee-worker/litentry/core/assertion-build/src/a11.rs b/tee-worker/litentry/core/assertion-build/src/a11.rs index 19647c0cb0..54e2d4acdc 100644 --- a/tee-worker/litentry/core/assertion-build/src/a11.rs +++ b/tee-worker/litentry/core/assertion-build/src/a11.rs @@ -29,7 +29,6 @@ use lc_data_providers::{ const VC_A11_SUBJECT_DESCRIPTION: &str = "The user has been consistently holding at least {x} amount of tokens before 2023 Jan 1st 00:00:00 UTC on the supporting networks"; const VC_A11_SUBJECT_TYPE: &str = "ETH Holding Assertion"; -const VC_A11_SUBJECT_TAG: [&str; 1] = ["Ethereum"]; // TODO: // The currently used achainable api is created by creating a label, so all parameters (including min_balance) are hardcoded into the label, and the following pr will be reconstructed using SysemLabel, so the current parameters are retained, but will be ignored. @@ -70,11 +69,7 @@ pub fn build(req: &AssertionBuildRequest, min_balance: ParameterString) -> Resul match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { - credential_unsigned.add_subject_info( - VC_A11_SUBJECT_DESCRIPTION, - VC_A11_SUBJECT_TYPE, - VC_A11_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A11_SUBJECT_DESCRIPTION, VC_A11_SUBJECT_TYPE); credential_unsigned.update_holder( is_hold, &q_min_balance, diff --git a/tee-worker/litentry/core/assertion-build/src/a13.rs b/tee-worker/litentry/core/assertion-build/src/a13.rs index 194688452d..753230d70f 100644 --- a/tee-worker/litentry/core/assertion-build/src/a13.rs +++ b/tee-worker/litentry/core/assertion-build/src/a13.rs @@ -29,7 +29,6 @@ use litentry_primitives::Address32; const VC_A13_SUBJECT_DESCRIPTION: &str = "The user has a Polkadot Decoded 2023 Litentry Booth Special Badge"; const VC_A13_SUBJECT_TYPE: &str = "Decoded 2023 Basic Special Badge"; -const VC_A13_SUBJECT_TAG: [&str; 2] = ["Polkadot decoded 2023", "Litentry"]; pub fn build( req: &AssertionBuildRequest, @@ -60,11 +59,7 @@ pub fn build( match Credential::new_default(&Address32::from(who.clone()).into(), &req.shard) { Ok(mut credential_unsigned) => { // add subject info - credential_unsigned.add_subject_info( - VC_A13_SUBJECT_DESCRIPTION, - VC_A13_SUBJECT_TYPE, - VC_A13_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A13_SUBJECT_DESCRIPTION, VC_A13_SUBJECT_TYPE); // add assertion credential_unsigned.add_assertion_a13(); diff --git a/tee-worker/litentry/core/assertion-build/src/a14.rs b/tee-worker/litentry/core/assertion-build/src/a14.rs index 9cbbd14009..26cc3ce58c 100644 --- a/tee-worker/litentry/core/assertion-build/src/a14.rs +++ b/tee-worker/litentry/core/assertion-build/src/a14.rs @@ -41,7 +41,6 @@ use ss58_registry::Ss58AddressFormat; const VC_A14_SUBJECT_DESCRIPTION: &str = "The user has participated in any Polkadot on-chain governance events"; const VC_A14_SUBJECT_TYPE: &str = "Polkadot Governance Participation Proof"; -const VC_A14_SUBJECT_TAG: [&str; 2] = ["Polkadot", "Governance"]; // mostly copied from https://github.com/hack-ink/substrate-minimal/blob/main/subcryptor/src/lib.rs // no_std version is used here @@ -178,11 +177,7 @@ pub fn build(req: &AssertionBuildRequest) -> Result { match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { // add subject info - credential_unsigned.add_subject_info( - VC_A14_SUBJECT_DESCRIPTION, - VC_A14_SUBJECT_TYPE, - VC_A14_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A14_SUBJECT_DESCRIPTION, VC_A14_SUBJECT_TYPE); // add assertion credential_unsigned.add_assertion_a14(value); diff --git a/tee-worker/litentry/core/assertion-build/src/a2.rs b/tee-worker/litentry/core/assertion-build/src/a2.rs index 8022521828..820b62b09d 100644 --- a/tee-worker/litentry/core/assertion-build/src/a2.rs +++ b/tee-worker/litentry/core/assertion-build/src/a2.rs @@ -26,7 +26,6 @@ use lc_data_providers::{discord_litentry::DiscordLitentryClient, vec_to_string}; const VC_A2_SUBJECT_DESCRIPTION: &str = "The user has obtained an ID-Hubber role in a Litentry Discord channel"; const VC_A2_SUBJECT_TYPE: &str = "Discord ID-Hubber Role Verification"; -const VC_A2_SUBJECT_TAG: [&str; 1] = ["Discord"]; pub fn build(req: &AssertionBuildRequest, guild_id: ParameterString) -> Result { debug!("Assertion A2 build, who: {:?}", account_id_to_string(&req.who)); @@ -61,11 +60,7 @@ pub fn build(req: &AssertionBuildRequest, guild_id: ParameterString) -> Result { - credential_unsigned.add_subject_info( - VC_A2_SUBJECT_DESCRIPTION, - VC_A2_SUBJECT_TYPE, - VC_A2_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A2_SUBJECT_DESCRIPTION, VC_A2_SUBJECT_TYPE); let value = discord_cnt > 0 && has_joined; credential_unsigned.add_assertion_a2(value, guild_id_s); diff --git a/tee-worker/litentry/core/assertion-build/src/a3.rs b/tee-worker/litentry/core/assertion-build/src/a3.rs index 7788e6744a..73c74400c2 100644 --- a/tee-worker/litentry/core/assertion-build/src/a3.rs +++ b/tee-worker/litentry/core/assertion-build/src/a3.rs @@ -26,7 +26,6 @@ use lc_data_providers::{discord_litentry::DiscordLitentryClient, vec_to_string}; const VC_A3_SUBJECT_DESCRIPTION: &str = "The user has commented in a specific Discord channel with a specific role"; const VC_A3_SUBJECT_TYPE: &str = "Discord Member Verification"; -const VC_A3_SUBJECT_TAG: [&str; 1] = ["Discord"]; pub fn build( req: &AssertionBuildRequest, @@ -76,11 +75,7 @@ pub fn build( match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { - credential_unsigned.add_subject_info( - VC_A3_SUBJECT_DESCRIPTION, - VC_A3_SUBJECT_TYPE, - VC_A3_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A3_SUBJECT_DESCRIPTION, VC_A3_SUBJECT_TYPE); credential_unsigned.add_assertion_a3( has_commented, guild_id_s, diff --git a/tee-worker/litentry/core/assertion-build/src/a4.rs b/tee-worker/litentry/core/assertion-build/src/a4.rs index 2dae6780ac..2088501ecb 100644 --- a/tee-worker/litentry/core/assertion-build/src/a4.rs +++ b/tee-worker/litentry/core/assertion-build/src/a4.rs @@ -76,7 +76,6 @@ use lc_data_providers::{ const VC_A4_SUBJECT_DESCRIPTION: &str = "The user has been consistently holding at least {x} amount of tokens before 2023 Jan 1st 00:00:00 UTC on the supporting networks"; const VC_A4_SUBJECT_TYPE: &str = "LIT Holding Assertion"; -const VC_A4_SUBJECT_TAG: [&str; 3] = ["Ethereum", "Litmus", "Litentry"]; // TODO: // The currently used achainable api is created by creating a label, so all parameters (including min_balance) are hardcoded into the label, and the following pr will be reconstructed using SysemLabel, so the current parameters are retained, but will be ignored. @@ -149,11 +148,7 @@ pub fn build(req: &AssertionBuildRequest, min_balance: ParameterString) -> Resul match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { - credential_unsigned.add_subject_info( - VC_A4_SUBJECT_DESCRIPTION, - VC_A4_SUBJECT_TYPE, - VC_A4_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A4_SUBJECT_DESCRIPTION, VC_A4_SUBJECT_TYPE); credential_unsigned.update_holder( is_hold, &q_min_balance, diff --git a/tee-worker/litentry/core/assertion-build/src/a6.rs b/tee-worker/litentry/core/assertion-build/src/a6.rs index 4527bf6c8d..d153ca3601 100644 --- a/tee-worker/litentry/core/assertion-build/src/a6.rs +++ b/tee-worker/litentry/core/assertion-build/src/a6.rs @@ -25,7 +25,6 @@ use lc_data_providers::twitter_official::TwitterOfficialClient; const VC_A6_SUBJECT_DESCRIPTION: &str = "The range of the user's Twitter follower count"; const VC_A6_SUBJECT_TYPE: &str = "Twitter Follower Amount"; -const VC_A6_SUBJECT_TAG: [&str; 1] = ["Twitter"]; /// Following ranges: /// @@ -94,11 +93,7 @@ pub fn build(req: &AssertionBuildRequest) -> Result { match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { - credential_unsigned.add_subject_info( - VC_A6_SUBJECT_DESCRIPTION, - VC_A6_SUBJECT_TYPE, - VC_A6_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A6_SUBJECT_DESCRIPTION, VC_A6_SUBJECT_TYPE); credential_unsigned.add_assertion_a6(min, max); Ok(credential_unsigned) diff --git a/tee-worker/litentry/core/assertion-build/src/a7.rs b/tee-worker/litentry/core/assertion-build/src/a7.rs index 5fb2500661..ea7a252550 100644 --- a/tee-worker/litentry/core/assertion-build/src/a7.rs +++ b/tee-worker/litentry/core/assertion-build/src/a7.rs @@ -29,7 +29,6 @@ use lc_data_providers::{ const VC_A7_SUBJECT_DESCRIPTION: &str = "The user has been consistently holding at least {x} amount of tokens before 2023 Jan 1st 00:00:00 UTC on the supporting networks"; const VC_A7_SUBJECT_TYPE: &str = "DOT Holding Assertion"; -const VC_A7_SUBJECT_TAG: [&str; 1] = ["Polkadot"]; // TODO: // The currently used achainable api is created by creating a label, so all parameters (including min_balance) are hardcoded into the label, and the following pr will be reconstructed using SysemLabel, so the current parameters are retained, but will be ignored. @@ -70,11 +69,7 @@ pub fn build(req: &AssertionBuildRequest, min_balance: ParameterString) -> Resul match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { - credential_unsigned.add_subject_info( - VC_A7_SUBJECT_DESCRIPTION, - VC_A7_SUBJECT_TYPE, - VC_A7_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A7_SUBJECT_DESCRIPTION, VC_A7_SUBJECT_TYPE); credential_unsigned.update_holder( is_hold, &q_min_balance, diff --git a/tee-worker/litentry/core/assertion-build/src/a8.rs b/tee-worker/litentry/core/assertion-build/src/a8.rs index 9a2f2e2b6c..0655a4e856 100644 --- a/tee-worker/litentry/core/assertion-build/src/a8.rs +++ b/tee-worker/litentry/core/assertion-build/src/a8.rs @@ -25,8 +25,6 @@ use lc_data_providers::achainable::{AchainableClient, AchainableTotalTransaction const VC_A8_SUBJECT_DESCRIPTION: &str = "The total amount of transaction the user has ever made in each of the available networks (including invalid transactions)"; const VC_A8_SUBJECT_TYPE: &str = "EVM/Substrate Transaction Count on Networks"; -const VC_A8_SUBJECT_TAG: [&str; 6] = - ["Litentry", "Litmus", "Polkadot", "Kusama", "Ethereum", "Khala"]; pub fn build(req: &AssertionBuildRequest) -> Result { debug!("Assertion A8 build, who: {:?}", account_id_to_string(&req.who),); @@ -51,11 +49,7 @@ pub fn build(req: &AssertionBuildRequest) -> Result { let (min, max) = get_total_tx_ranges(total_txs); match Credential::new_default(&req.who, &req.shard) { Ok(mut credential_unsigned) => { - credential_unsigned.add_subject_info( - VC_A8_SUBJECT_DESCRIPTION, - VC_A8_SUBJECT_TYPE, - VC_A8_SUBJECT_TAG.to_vec(), - ); + credential_unsigned.add_subject_info(VC_A8_SUBJECT_DESCRIPTION, VC_A8_SUBJECT_TYPE); credential_unsigned.add_assertion_a8(networks, min, max); Ok(credential_unsigned) diff --git a/tee-worker/litentry/core/credentials/src/lib.rs b/tee-worker/litentry/core/credentials/src/lib.rs index 0dc3f658bc..4d95458d2f 100644 --- a/tee-worker/litentry/core/credentials/src/lib.rs +++ b/tee-worker/litentry/core/credentials/src/lib.rs @@ -132,8 +132,6 @@ pub struct CredentialSubject { pub description: String, #[serde(rename = "type")] pub types: String, - /// (Optional) Some externally provided identifiers - pub tag: Vec, /// (Optional) Data source definitions for trusted data providers #[serde(skip_serializing_if = "Option::is_none")] pub data_source: Option>, @@ -368,12 +366,9 @@ impl Credential { self.credential_subject.values.push(is_hold); } - pub fn add_subject_info(&mut self, subject_description: &str, types: &str, tag: Vec<&str>) { + pub fn add_subject_info(&mut self, subject_description: &str, types: &str) { self.credential_subject.description = subject_description.into(); self.credential_subject.types = types.into(); - - let tag = tag.iter().map(|s| s.to_string()).collect(); - self.credential_subject.tag = tag; } pub fn add_assertion_a1(&mut self, value: bool) { diff --git a/tee-worker/litentry/core/credentials/src/templates/credential.json b/tee-worker/litentry/core/credentials/src/templates/credential.json index 2c41d3a3a7..ad7bd74ca7 100644 --- a/tee-worker/litentry/core/credentials/src/templates/credential.json +++ b/tee-worker/litentry/core/credentials/src/templates/credential.json @@ -19,9 +19,6 @@ "id":"", "description":"", "type":"", - "tag":[ - "IDHub" - ], "assertions":[ ], diff --git a/tee-worker/litentry/core/credentials/src/templates/credential_schema.json b/tee-worker/litentry/core/credentials/src/templates/credential_schema.json index 90234bfcfd..6d6b46e4ca 100644 --- a/tee-worker/litentry/core/credentials/src/templates/credential_schema.json +++ b/tee-worker/litentry/core/credentials/src/templates/credential_schema.json @@ -42,9 +42,6 @@ "type":{ "type":"string" }, - "tag":{ - "type":"array" - }, "assertions":{ "type":"array", "items":{