From 1362036b4c3fcc197f8649dd25b1126e779b189c Mon Sep 17 00:00:00 2001 From: Kai <7630809+Kailai-Wang@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:49:46 +0200 Subject: [PATCH] Hotfix LIT/DOT Holder VC (#2795) * use no-metadata * add debug * fix return value * use no-metadata for total tx * bump versions * fix versions in ts --- runtime/litentry/src/lib.rs | 2 +- runtime/litmus/src/lib.rs | 2 +- runtime/rococo/src/lib.rs | 2 +- tee-worker/app-libs/sgx-runtime/src/lib.rs | 2 +- .../assertion-build/src/achainable/mod.rs | 2 +- .../core/data-providers/src/achainable.rs | 20 ++++++++++++++----- .../common/utils/assertion.ts | 2 +- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/runtime/litentry/src/lib.rs b/runtime/litentry/src/lib.rs index 932ca4ba4f..f4081bfd44 100644 --- a/runtime/litentry/src/lib.rs +++ b/runtime/litentry/src/lib.rs @@ -143,7 +143,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("litentry-parachain"), authoring_version: 1, // same versioning-mechanism as polkadot: use last digit for minor updates - spec_version: 9180, + spec_version: 9181, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/litmus/src/lib.rs b/runtime/litmus/src/lib.rs index affc73a4af..1a0f782ff8 100644 --- a/runtime/litmus/src/lib.rs +++ b/runtime/litmus/src/lib.rs @@ -151,7 +151,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("litmus-parachain"), authoring_version: 1, // same versioning-mechanism as polkadot: use last digit for minor updates - spec_version: 9180, + spec_version: 9181, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index 92185aac0a..1e299692af 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -243,7 +243,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("rococo-parachain"), authoring_version: 1, // same versioning-mechanism as polkadot: use last digit for minor updates - spec_version: 9180, + spec_version: 9181, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/tee-worker/app-libs/sgx-runtime/src/lib.rs b/tee-worker/app-libs/sgx-runtime/src/lib.rs index cee8cf4dc0..5db9bf6614 100644 --- a/tee-worker/app-libs/sgx-runtime/src/lib.rs +++ b/tee-worker/app-libs/sgx-runtime/src/lib.rs @@ -139,7 +139,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("node-template"), impl_name: create_runtime_str!("node-template"), authoring_version: 1, - spec_version: 106, + spec_version: 107, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/tee-worker/litentry/core/assertion-build/src/achainable/mod.rs b/tee-worker/litentry/core/assertion-build/src/achainable/mod.rs index ec9abf7025..c0199c19ac 100644 --- a/tee-worker/litentry/core/assertion-build/src/achainable/mod.rs +++ b/tee-worker/litentry/core/assertion-build/src/achainable/mod.rs @@ -111,7 +111,7 @@ pub fn request_achainable( ) })?; - Ok(false) + Ok(result) } pub fn request_uniswap_v2_or_v3_user( diff --git a/tee-worker/litentry/core/data-providers/src/achainable.rs b/tee-worker/litentry/core/data-providers/src/achainable.rs index 3c60e17394..69a25599e0 100644 --- a/tee-worker/litentry/core/data-providers/src/achainable.rs +++ b/tee-worker/litentry/core/data-providers/src/achainable.rs @@ -57,7 +57,8 @@ impl AchainableClient { } pub fn query_system_label(&mut self, address: &str, params: Params) -> Result { - let body = ReqBody::new(address.into(), params); + // TODO: double-check it with Zhouhui if we don't ever need metadata here + let body = ReqBody::new_with_false_metadata(address.into(), params); self.post(SystemLabelReqPath::default(), &body) .and_then(AchainableClient::parse) } @@ -96,8 +97,13 @@ impl AchainablePost for AchainableClient { let response = self .client .post_capture::(params, body); - debug!("ReqBody response: {:?}", response); - response.map_err(|e| Error::AchainableError(format!("Achainable response error: {}", e))) + match response { + Ok(r) => { + debug!("ReqBody response: {}", r); + Ok(r) + }, + Err(e) => Err(Error::AchainableError(format!("Achainable response error: {}", e))), + } } } @@ -690,7 +696,8 @@ fn check_achainable_label( address: &str, params: Params, ) -> Result { - let body = ReqBody::new(address.into(), params); + // TODO: double-check it with Zhouhui if we don't ever need metadata here + let body = ReqBody::new_with_false_metadata(address.into(), params); client .post(SystemLabelReqPath::default(), &body) .and_then(AchainableClient::parse) @@ -796,7 +803,10 @@ impl AchainableAccountTotalTransactions for AchainableClient { let amount = "1".to_string(); let param = ParamsBasicTypeWithAmount::new(name, network, amount); - let body = ReqBody::new(address.into(), Params::ParamsBasicTypeWithAmount(param)); + let body = ReqBody::new_with_false_metadata( + address.into(), + Params::ParamsBasicTypeWithAmount(param), + ); let tx = self.post(SystemLabelReqPath::default(), &body).and_then(Self::parse_txs)?; txs += tx; diff --git a/tee-worker/ts-tests/integration-tests/common/utils/assertion.ts b/tee-worker/ts-tests/integration-tests/common/utils/assertion.ts index 8a5a6bb22a..d507d814f3 100644 --- a/tee-worker/ts-tests/integration-tests/common/utils/assertion.ts +++ b/tee-worker/ts-tests/integration-tests/common/utils/assertion.ts @@ -156,7 +156,7 @@ export async function assertVc(context: IntegrationTestContext, subject: CorePri // check runtime version is present assert.deepEqual( vcPayloadJson.issuer.runtimeVersion, - { parachain: 9180, sidechain: 106 }, + { parachain: 9181, sidechain: 107 }, 'Check VC runtime version: it should equal the current defined versions' );