Skip to content

Commit

Permalink
add storage query sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
0xverin committed Jun 1, 2023
1 parent bda99a7 commit 575f7b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions tee-worker/ts-tests/common/utils/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import type { PalletIdentityManagementTeeIdentityContext } from '@polkadot/types
import type { HexString } from '@polkadot/util/types';
import type { Metadata } from '@polkadot/types';

const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

const base58 = require('micro-base58');

//sidechain storage utils
Expand Down Expand Up @@ -95,6 +97,8 @@ export async function checkUserShieldingKeys(
method: string,
address: HexString
): Promise<string> {
sleep(6000);

const storageKey = await buildStorageHelper(context.metaData, pallet, method, address);

let base58mrEnclave = base58.encode(Buffer.from(context.mrEnclave.slice(2), 'hex'));
Expand All @@ -116,6 +120,8 @@ export async function checkUserChallengeCode(
address: HexString,
identity: HexString
): Promise<string> {
sleep(6000);

const storageKey = await buildStorageHelper(context.metaData, pallet, method, address, identity);

let base58mrEnclave = base58.encode(Buffer.from(context.mrEnclave.slice(2), 'hex'));
Expand All @@ -137,6 +143,7 @@ export async function checkIDGraph(
address: HexString,
identity: HexString
): Promise<PalletIdentityManagementTeeIdentityContext> {
sleep(6000);
const storageKey = await buildStorageHelper(context.metaData, pallet, method, address, identity);

let base58mrEnclave = base58.encode(Buffer.from(context.mrEnclave.slice(2), 'hex'));
Expand Down
4 changes: 0 additions & 4 deletions tee-worker/ts-tests/identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ describeLitentry('Test Identity', 0, (context) => {
]);
await checkErrorDetail(resp_events, 'UserShieldingKeyNotFound');
});
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

step('set user shielding key', async function () {
// await sleep(6000);
let [alice_txs] = (await buildIdentityTxs(
context,
[context.substrateWallet.alice],
Expand All @@ -99,8 +97,6 @@ describeLitentry('Test Identity', 0, (context) => {
['UserShieldingKeySet']
);

await sleep(6000);

await assertInitialIDGraphCreated(
context,
[context.substrateWallet.alice, context.substrateWallet.bob],
Expand Down
3 changes: 0 additions & 3 deletions tee-worker/ts-tests/vc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,13 @@ describeLitentry('VC test', 0, async (context) => {
'alice shielding key should be set'
);
});
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
step('check user shielding key from sidechain storage after setUserShieldingKey', async function () {
await sleep(6000);
const resp_shieldingKey = await checkUserShieldingKeys(
context,
'IdentityManagement',
'UserShieldingKeys',
u8aToHex(context.substrateWallet.alice.addressRaw)
);
await sleep(6000);
assert.equal(resp_shieldingKey, aesKey, 'resp_shieldingKey should be equal aesKey after set');
});
step('Request VC', async () => {
Expand Down

0 comments on commit 575f7b2

Please sign in to comment.