Skip to content

Commit

Permalink
Merge pull request #19 from iExecBlockchainComputing/release/2.0.0
Browse files Browse the repository at this point in the history
Release/2.0.0
  • Loading branch information
jeremyjams authored Nov 18, 2022
2 parents 10b1540 + 20cebe9 commit c983088
Show file tree
Hide file tree
Showing 34 changed files with 755 additions and 152 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ node_modules/
coverage/
app/
tests/test_out/computed.json
src/config.json

chain.json
deployed.json
orders.json
12 changes: 12 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
@Library('global-jenkins-library@2.0.0') _

docker.image('node:16-alpine').inside {
stage('Test') {
checkout scm
sh '''
npm ci
cp config.prod.json src/config.json
npm run ci-test
'''
archiveArtifacts artifacts: 'coverage/'
}
}

appName = 'generic-oracle-dapp'
buildInfo = getBuildInfo()

Expand Down
15 changes: 14 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TARGET_PRIVATE_KEY=
## Build native image

```
docker image build -f docker/Dockerfile -t generic-oracle-dapp:local .
docker image build -f docker/Dockerfile -t generic-oracle-dapp:local --build-arg CONFIG_FILE=config.local.json .
```

## Build TEE debug image
Expand All @@ -81,22 +81,35 @@ npm run scone
```
iexec app deploy --chain bellecour
```
```
npx ts-node scripts/buildAppSecret.ts <authorized-reporter-private-key>
```

```
iexec-core-cli app push-owner-secret --secret=$MY_SECRETS --sms=<sms_url> --wallet-path=/tmp/wallet.json --wallet-password
```
or
```
iexec app push-secret --chain bellecour <app_address> --secret-value $MY_SECRETS
```

```
iexec order sign --app --chain bellecour
```

### As requester: trigger crosschain app

Update iexec.json, make requester wallet file available and run:
```
runTask.sh <0xrequesterAddress>
```
or
```
iexec order sign --request --chain bellecour
```
```
iexec orderbook workerpool --tag tee <0xworkerpool> --chain bellecour
iexec orderbook workerpool --tag tee <0xworkerpool> --chain bellecour --raw | jq -r .workerpoolOrders[0].orderHash
```
```
iexec order fill --chain bellecour --workerpool <order>
Expand Down
15 changes: 15 additions & 0 deletions config.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"forwarderApiUrl": "https://forwarder.dev-oracle-factory.iex.ec",
"onChainConfig": {
"5": {
"forwarder": "0x2aD6aD4F35cf7354fE703da74F459690dBcC12bf",
"oracle": "0x8dFf608952ADCDa4cF7320324Db1ef44001BE79b",
"providerUrl": ""
},
"80001": {
"forwarder": "0xa715674ecf9D14141421190b6f8Acf20686b54d7",
"oracle": "0x330031CF7e6E2C318Dba230fe25A7f39fD3644EA",
"providerUrl": "https://rpc-mumbai.maticvigil.com"
}
}
}
15 changes: 15 additions & 0 deletions config.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"forwarderApiUrl": "http://localhost:5000",
"onChainConfig": {
"5": {
"forwarder": "0x2aD6aD4F35cf7354fE703da74F459690dBcC12bf",
"oracle": "0x8dFf608952ADCDa4cF7320324Db1ef44001BE79b",
"providerUrl": ""
},
"80001": {
"forwarder": "0xa715674ecf9D14141421190b6f8Acf20686b54d7",
"oracle": "0x330031CF7e6E2C318Dba230fe25A7f39fD3644EA",
"providerUrl": "https://rpc-mumbai.maticvigil.com"
}
}
}
25 changes: 25 additions & 0 deletions config.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"forwarderApiUrl": "https://forwarder.oracle-factory.iex.ec",
"onChainConfig": {
"1": {
"forwarder": "0xc684E8645c8414812f22918146d72d1071E722AE",
"oracle": "0x36dA71ccAd7A67053f0a4d9D5f55b725C9A25A3E",
"providerUrl": ""
},
"5": {
"forwarder": "0xc684E8645c8414812f22918146d72d1071E722AE",
"oracle": "0x36dA71ccAd7A67053f0a4d9D5f55b725C9A25A3E",
"providerUrl": ""
},
"137": {
"forwarder": "0xc684E8645c8414812f22918146d72d1071E722AE",
"oracle": "0x36dA71ccAd7A67053f0a4d9D5f55b725C9A25A3E",
"providerUrl": "https://rpc-mainnet.maticvigil.com"
},
"80001": {
"forwarder": "0xc684E8645c8414812f22918146d72d1071E722AE",
"oracle": "0x36dA71ccAd7A67053f0a4d9D5f55b725C9A25A3E",
"providerUrl": "https://rpc-mumbai.maticvigil.com"
}
}
}
5 changes: 0 additions & 5 deletions deployed.json

This file was deleted.

1 change: 1 addition & 0 deletions docker/.env-build-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ARG CONFIG_FILE=config.dev.json
1 change: 1 addition & 0 deletions docker/.env-build-local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ARG CONFIG_FILE=config.local.json
1 change: 1 addition & 0 deletions docker/.env-build-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ARG CONFIG_FILE=config.prod.json
13 changes: 9 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
FROM node:14-alpine3.10 AS builder
WORKDIR /app
COPY package*.json tsconfig.json ./
COPY src/ .
COPY src/ /src/
# region-config-file
ARG CONFIG_FILE
RUN echo "CONFIG_FILE : ${CONFIG_FILE}"
RUN test -n "$CONFIG_FILE"
COPY $CONFIG_FILE src/config.json
RUN cat src/config.json
# endregion-config-file
RUN npm ci
# Future note: Run unit tests automatically
RUN npm run build
# Copy generated *.js to /app so we can use them
RUN cp -R app/* ./
RUN cp -R app/src/* ./app

FROM node:14-alpine3.10
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion docker/sconify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ ARGS=$(sed -e "s'\${IMG_FROM}'${IMG_FROM}'" -e "s'\${IMG_TO}'${IMG_TO}'" sconify
echo $ARGS

/bin/bash -c "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
registry.scontain.com:5050/sconecuratedimages/iexec-sconify-image:5.3.6 \
registry.scontain.com:5050/scone-production/iexec-sconify-image:5.3.15 \
sconify_iexec $ARGS"
28 changes: 14 additions & 14 deletions iexec.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,50 +16,50 @@
"callback": "0x0000000000000000000000000000000000000000"
},
"app": {
"owner": "0x15Bd06807eF0F2284a9C5baeAA2EF4d5a88eB72A",
"name": "generic-oracle-dapp-2",
"owner": "<0xAppDeveloper>",
"name": "generic-oracle-dapp",
"type": "DOCKER",
"multiaddr": "docker.io/iexechub/generic-oracle-dapp:feature-99feb9ab-sconify-5.3.15-debug",
"checksum": "0xd0d4c6828115d01ec5f4fd8350bd485f9f4b904050fdce7be77ab6655af11df4",
"multiaddr": "docker.io/iexechub/generic-oracle-dapp:<xxx>",
"checksum": "0xf7485b254816519e4e49aaaa66e31a99877f3fd19feb2dfe880513b44bfe4fde",
"mrenclave": {
"provider": "SCONE",
"version": "v5",
"entrypoint": "node /app/app.js",
"heapSize": 1073741824,
"fingerprint": "820fef5ec06be4bf1b49e463a0f4a6531254807d2d34b33c8e454f5ac46c8b2c"
"fingerprint": "0e485080518310768ebab8eff3600bb188fe9b669ce19092dde984ab7c900fad"
}
},
"order": {
"requestorder": {
"app": "0xa7E233a6648d77872005E7C4689B63DFbbDd8857",
"app": "<0xApp>",
"appmaxprice": "0",
"dataset": "0x0000000000000000000000000000000000000000",
"datasetmaxprice": "0",
"workerpool": "0x09bc1b06A695Fa9d2A98AC336331872EA81F307D",
"workerpoolmaxprice": "10000000",
"workerpool": "0xEb14Dc854A8873e419183c81a657d025EC70276b",
"workerpoolmaxprice": "0",
"volume": "1",
"category": "0",
"trust": "0",
"tag": "0x0000000000000000000000000000000000000000000000000000000000000001",
"beneficiary": "0x15Bd06807eF0F2284a9C5baeAA2EF4d5a88eB72A",
"callback": "0x8ecEDdd1377E52d23A46E2bd3dF0aFE35B526D5F",
"params": {
"iexec_args": "",
"iexec_args": "5,80001",
"iexec_input_files": [
"https://raw.githubusercontent.com/iExecBlockchainComputing/generic-oracle-dapp/feature/goerli-crosschain/tests/test_files/input_file_no_dataset.json"
"https://raw.githubusercontent.com/iExecBlockchainComputing/generic-oracle-dapp/develop/tests/test_files/input_file_no_dataset.json"
],
"iexec_result_encryption": false,
"iexec_developer_logger": true
},
"requester": "0x15Bd06807eF0F2284a9C5baeAA2EF4d5a88eB72A"
"requester": "<0xRequester>"
},
"apporder": {
"app": "0xa7E233a6648d77872005E7C4689B63DFbbDd8857",
"app": "<0xApp>",
"appprice": "0",
"volume": "10",
"volume": "1000",
"tag": "0x0000000000000000000000000000000000000000000000000000000000000001",
"datasetrestrict": "0x0000000000000000000000000000000000000000",
"workerpoolrestrict": "0x0000000000000000000000000000000000000000",
"workerpoolrestrict": "0xEb14Dc854A8873e419183c81a657d025EC70276b",
"requesterrestrict": "0x0000000000000000000000000000000000000000"
}
}
Expand Down
31 changes: 23 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "This application is meant to build a docker container usable in SGX iexec tasks. The dapp take an input file containing a param set in a JSON format. The param set describe the request that should be done to the target API in order to get the wanted data.",
"main": "src/app.js",
"dependencies": {
"@iexec/generic-oracle-contracts": "^2.0.0",
"@iexec/generic-oracle-contracts": "^2.2.0",
"big.js": "^6.0.3",
"ethers": "^5.6.8",
"jsonpath": "^1.1.0",
Expand Down Expand Up @@ -38,8 +38,9 @@
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
"test": "jest --coverage",
"itest": "jest --coverage tests/dapp.integ.test.ts",
"ci-test": "jest --coverage --testPathIgnorePatterns=\"dapp.integ\"",
"build": "tsc",
"scone": "bash sconify.sh"
"scone": "bash docker/sconify.sh"
},
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions runTask.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Usage: ./runTask.sh <0xrequesterAddress>

REQUESTER=$1
# Bellecour prod pool
WORKERPOOL=0xEb14Dc854A8873e419183c81a657d025EC70276b
WALLET="--wallet-address $REQUESTER"
CHAIN="--chain bellecour"

iexec order sign --request $CHAIN
WORKERPOOL_ORDER=$(iexec orderbook workerpool --tag tee $WORKERPOOL $CHAIN --raw | jq -r .workerpoolOrders[0].orderHash)
echo "WORKERPOOL_ORDER: $WORKERPOOL_ORDER"
iexec order fill --workerpool $WORKERPOOL_ORDER $CHAIN $WALLET
9 changes: 9 additions & 0 deletions scripts/buildAppSecret.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { buildAppSecret } from "../tests/utils";

process.env.INFURA_PROJECT_ID = "";
process.env.INFURA_PROJECT_SECRET = "";
const encodedAppSecret = buildAppSecret(process.argv[2]);
console.log(encodedAppSecret);

// Enable it to verify final app secret
//console.log("App secret recovered [decodedAppSecret:%s]", Buffer.from(encodedAppSecret, "base64").toString());
Loading

0 comments on commit c983088

Please sign in to comment.