Skip to content

Commit 2ce3d54

Browse files
refactor: use TEE_FRAMEWORK as var
1 parent c0a2e7d commit 2ce3d54

5 files changed

Lines changed: 13 additions & 33 deletions

File tree

.github/workflows/dapp-deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ jobs:
140140
PRICE: ${{ vars.SELL_ORDER_PRICE }}
141141
VOLUME: ${{ vars.SELL_ORDER_VOLUME }}
142142
RPC_URL: ${{ secrets.RPC_URL }}
143+
TEE_FRAMEWORK: ${{ vars.TEE_FRAMEWORK }}
143144
run: |
144145
cd deployment-dapp
145146
npm run publish-sell-order
@@ -210,7 +211,7 @@ jobs:
210211
PRICE: ${{ vars.SELL_ORDER_PRICE }}
211212
VOLUME: ${{ vars.SELL_ORDER_VOLUME }}
212213
RPC_URL: ${{ secrets.RPC_URL }}
213-
SCONIFY_VERSION: ${{ vars.SCONIFY_VERSION }}
214+
TEE_FRAMEWORK: ${{ vars.TEE_FRAMEWORK }}
214215
run: |
215216
cd deployment-dapp
216217
npm run publish-sell-order

deployment-dapp/src/config/config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
//deployment parameters
44
export const APP_NAME = 'web3mail';
55
export const APP_TYPE = 'DOCKER';
6-
export const FRAMEWORK = 'TDX';
7-
8-
export const APP_TAG = ['tee', FRAMEWORK.toLowerCase()];
96

107
export const DOCKER_IMAGE_NAMESPACE = 'iexechub';
118
export const DOCKER_IMAGE_REPOSITORY = 'web3mail-dapp';

deployment-dapp/src/publishSellOrderScript.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import {
66
} from './utils/validator.js';
77

88
const main = async () => {
9-
const { RPC_URL, WALLET_PRIVATE_KEY, PRICE, VOLUME } = process.env;
9+
const { RPC_URL, WALLET_PRIVATE_KEY, PRICE, VOLUME, TEE_FRAMEWORK } =
10+
process.env;
1011

1112
const iexec = getIExec(WALLET_PRIVATE_KEY, RPC_URL);
1213

1314
const appAddress = await loadAppAddress();
1415

1516
if (!appAddress) throw Error('Failed to get app address'); // If the app was not deployed, do not continue
1617

18+
const teeFramework = TEE_FRAMEWORK ?? 'tdx';
19+
1720
// validate params
1821
const price = await positiveNumberSchema()
1922
.required()
@@ -29,7 +32,7 @@ const main = async () => {
2932

3033
try {
3134
// Publish sell order for TEE app
32-
await publishSellOrder(iexec, appAddress, price, volume);
35+
await publishSellOrder(iexec, appAddress, price, volume, teeFramework);
3336
} catch (e) {
3437
throw Error(`Failed to publish app sell order: ${e}`);
3538
}

deployment-dapp/src/singleFunction/publishSellOrder.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
import { IExec } from 'iexec';
2-
import { APP_TAG } from '../config/config.js';
1+
import { IExec, TeeFramework } from 'iexec';
32

43
export const publishSellOrder = async (
54
iexec: IExec,
65
appAddress: string,
76
price?: number,
8-
volume?: number
7+
volume?: number,
8+
teeFramework: TeeFramework = 'tdx'
99
): Promise<string> => {
10-
let teeTag = APP_TAG;
11-
// TODO: to be deleted after migration to TDX
12-
const sconifyVersion = process.env.SCONIFY_VERSION;
13-
if (sconifyVersion) {
14-
console.log(
15-
`Using SCONE framework with SCONIFY version: ${sconifyVersion}`
16-
);
17-
teeTag = ['tee', 'scone'];
18-
}
10+
const teeTag = ['tee', teeFramework];
1911
console.log(
2012
`Publishing apporder for app ${appAddress} with price ${price} xRLC and volume ${volume} on ${teeTag}`
2113
);

deployment-dapp/src/singleFunction/pushSecret.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,8 @@ export const pushSecret = async (
55
appAddress: string,
66
secret: string
77
): Promise<boolean> => {
8-
// TODO: to be deleted after migration to TDX
9-
const sconifyVersion = process.env.SCONIFY_VERSION;
10-
let teeFramework = 'tdx';
11-
if (sconifyVersion) {
12-
console.log(
13-
`Using SCONE framework with SCONIFY version: ${sconifyVersion}`
14-
);
15-
teeFramework = 'scone';
16-
}
17-
console.log(
18-
`Pushing app secret for app ${appAddress} on SMS ${teeFramework}`
19-
);
20-
const isPushed = await iexec.app.pushAppSecret(appAddress, secret, {
21-
teeFramework,
22-
});
8+
console.log(`Pushing app secret for app ${appAddress}`);
9+
const isPushed = await iexec.app.pushAppSecret(appAddress, secret);
2310
console.log(`success: ${isPushed}`);
2411
return isPushed;
2512
};

0 commit comments

Comments
 (0)