Skip to content

Commit b832d8b

Browse files
committed
add a workaround link_identity_short
1 parent c5ad380 commit b832d8b

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

tee-worker/app-libs/stf/src/trusted_call.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,19 @@ pub enum TrustedCall {
127127
remove_identity(Identity, Identity, Identity, H256),
128128
request_vc(Identity, Identity, Assertion, H256),
129129
set_identity_networks(Identity, Identity, Identity, Vec<Web3Network>),
130+
// a hotfix to work around the "too long encoded call size" problem
131+
// it's similiar to `link_identity`, but with reduced parameters:
132+
// - the first identity is the prime identity, whose signature is required
133+
// - the second identity is the to-be-linked identity
134+
// in this sense, it can only be called via DI
135+
link_identity_short(
136+
Identity,
137+
Identity,
138+
ValidationData,
139+
Vec<Web3Network>,
140+
UserShieldingKeyNonceType,
141+
H256,
142+
),
130143
set_user_shielding_key_with_networks(
131144
Identity,
132145
Identity,
@@ -167,6 +180,7 @@ impl TrustedCall {
167180
TrustedCall::set_identity_networks(sender_identity, ..) => sender_identity,
168181
TrustedCall::set_user_shielding_key_with_networks(sender_identity, ..) =>
169182
sender_identity,
183+
TrustedCall::link_identity_short(sender_identity, ..) => sender_identity,
170184
TrustedCall::link_identity_callback(sender_identity, ..) => sender_identity,
171185
TrustedCall::request_vc_callback(sender_identity, ..) => sender_identity,
172186
TrustedCall::handle_imp_error(sender_identity, ..) => sender_identity,
@@ -564,6 +578,38 @@ where
564578
}
565579
Ok(())
566580
},
581+
TrustedCall::link_identity_short(
582+
signer,
583+
identity,
584+
validation_data,
585+
web3networks,
586+
nonce,
587+
hash,
588+
) => {
589+
debug!("link_identity_short, who: {}", account_id_to_string(&signer));
590+
591+
if let Err(e) = Self::link_identity_internal(
592+
signer.to_account_id().ok_or(Self::Error::InvalidAccount)?,
593+
signer.clone(),
594+
identity,
595+
validation_data,
596+
web3networks,
597+
nonce,
598+
hash,
599+
shard,
600+
) {
601+
add_call_from_imp_error(
602+
calls,
603+
node_metadata_repo,
604+
Some(SgxParentchainTypeConverter::convert(
605+
signer.to_account_id().ok_or(Self::Error::InvalidAccount)?,
606+
)),
607+
e.to_imp_error(),
608+
hash,
609+
);
610+
}
611+
Ok(())
612+
},
567613
TrustedCall::remove_identity(signer, who, identity, hash) => {
568614
debug!("remove_identity, who: {}", account_id_to_string(&who));
569615
let account = SgxParentchainTypeConverter::convert(
@@ -778,6 +824,7 @@ where
778824
TrustedCall::link_identity_callback(..) => debug!("No storage updates needed..."),
779825
TrustedCall::request_vc_callback(..) => debug!("No storage updates needed..."),
780826
TrustedCall::set_identity_networks(..) => debug!("No storage updates needed..."),
827+
TrustedCall::link_identity_short(..) => debug!("No storage updates needed..."),
781828
TrustedCall::set_user_shielding_key_with_networks(..) =>
782829
debug!("No storage updates needed..."),
783830
TrustedCall::handle_imp_error(..) => debug!("No storage updates needed..."),

tee-worker/litentry/core/data-providers/src/geniidata.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use itc_rest_client::{
2929
rest_client::RestClient,
3030
RestGet, RestPath,
3131
};
32-
use litentry_primitives::ErrorDetail;
3332
use serde::{Deserialize, Serialize};
3433
use std::{
3534
format, str,

tee-worker/ts-tests/parachain-api/prepare-build/interfaces/identity/definitions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export default {
5959
request_vc: "(LitentryIdentity, LitentryIdentity, Assertion, H256)",
6060
set_identity_networks:
6161
"(LitentryIdentity, LitentryIdentity, LitentryIdentity, Vec<Web3Network>)",
62+
link_identity_short:
63+
"(LitentryIdentity, LitentryIdentity, LitentryValidationData, Vec<Web3Network>, UserShieldingKeyNonceType, H256)",
64+
6265
},
6366
},
6467
UserShieldingKeyType: "[u8; 32]",

0 commit comments

Comments
 (0)