Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.1.1 #33

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ steps:

- name: get scone fingerprint (prod)
# /!\: maintain the version here
image: iexechub/generic-oracle-dapp:2.1.0-sconify-5.7.5-v12-production
image: iexechub/generic-oracle-dapp:2.1.1-sconify-5.7.5-v12-production
commands:
- SCONE_HASH=1 node > deployment-dapp/.scone-fingerprint
when:
Expand Down Expand Up @@ -263,6 +263,27 @@ steps:
- cd deployment-dapp
- npm run configure-ens

- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack-webhook-product-dev
template: >
🏗️ {{repo.name}} build <{{build.link}}|#{{build.number}}>

⚠️ A new version of oracle-factory dapp has been deployed ⚠️

ENS <https://explorer.iex.ec/bellecour/search/oracle-factory.apps.iexec.eth|oracle-factory.apps.iexec.eth> has been moved to the new app

👉 `VerifiedResultOracle` authorized app whitelist must be updated

<https://iexecproject.atlassian.net/wiki/spaces/IP/pages/3033038904/generic-oracle-contracts#Add-authorized-app|Add authorized app>
when:
target:
- dapp-prod
branch:
- main

---
# pipeline to publish sell order
kind: pipeline
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

## [2.1.1]

### Changed

- Fixed Polygon cross-chain
- Fixed bad error handling

### Removed

- Removed cross-chain to discontinued chains Goerli testnet and Polygon Mumbai testnet

## [2.1.0]

### Changed

- migrated to sconifier 5.7.5-v12

## [2.0.0]

### Added

- cross-chain support for Ethereum mainnet, Polygon PoS, Goerli testnet, Polygon Mumbai testnet
12 changes: 1 addition & 11 deletions config.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@
"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"
"providerUrl": ""
}
}
}
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generic-oracle-dapp",
"version": "2.1.0",
"version": "2.1.1",
"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",
"scripts": {
Expand Down
8 changes: 1 addition & 7 deletions src/dapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ const start = async () => {
JSONPath: paramSet.JSONPath,
dataType: paramSet.dataType,
});
console.log(
"Received response from API [url:%s, date:%s, value:%s]",
paramSet.url,
new Date(date * 1000),
value
);

let encodedValue: string;
try {
Expand Down Expand Up @@ -92,7 +86,7 @@ const start = async () => {
if (allForwardRequestsAccepted) {
console.log("All forward requests accepted by Forwarder API");
} else {
console.error("At least one forward request rejected by Forwarder API");
console.error("At least one forward request did not succeed");
}
}
return encodedValue;
Expand Down
40 changes: 19 additions & 21 deletions src/forward/forwardHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,30 @@ export async function triggerForwardRequests(

const successes = await Promise.all(
requestedChainIds.map(async (chainId) => {
const onChainConfig = getOnChainConfig(chainId);
if (!onChainConfig) {
console.error(
"Foreign blockchain requested is not supported [chainId:%s, oracleId:%s, taskId:%s]",
try {
const onChainConfig = getOnChainConfig(chainId);
if (!onChainConfig) {
console.error(
"Foreign blockchain requested is not supported [chainId:%s, oracleId:%s, taskId:%s]",
chainId,
oracleId,
taskId
);
return false;
}
const signedForwardRequest = await signForwardRequest(
chainId,
wallet,
taskId,
oracleId,
taskId
encodedValue,
onChainConfig
);
return await postForwardRequest(signedForwardRequest, oracleId, taskId);
} catch (e) {
// catch promise rejection and convert it to false to prevent Promise.all rejection
return false;
}

const signedForwardRequest = await signForwardRequest(
chainId,
wallet,
taskId,
oracleId,
encodedValue,
onChainConfig
// catch promise rejection and convert it to false to prevent Promise.all rejection
).catch((e) => false);

return await postForwardRequest(
signedForwardRequest,
oracleId,
taskId
).catch((e) => false);
})
);

Expand Down
2 changes: 1 addition & 1 deletion src/forward/forwardSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function postForwardRequest(
await response
.json()
.then((body) => body.message)
.then(console.log)
.catch((e) => undefined)
);
return false;
}
6 changes: 3 additions & 3 deletions tests/forward/forwardEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {

describe("Environment", () => {
test("should get environment", async () => {
expect(getForwarderApiUrl()).toContain("http");
expect(getOnChainConfig(5)).toBeDefined();
expect(getOnChainConfig(80001)).toBeDefined();
expect(getForwarderApiUrl()).toContain("https");
expect(getOnChainConfig(1)).toBeDefined();
expect(getOnChainConfig(137)).toBeDefined();
});
});
2 changes: 1 addition & 1 deletion tests/forward/forwardHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const postMultiForwardRequestMock = postForwardRequest as jest.MockedFunction<

const TASK_ID =
"0x0000000000000000000000000000000000000000000000000000000000000abc";
const CHAIN_ID = 5;
const CHAIN_ID = 137;
const ORACLE_ID = "0x1";
const VALUE = "0x2";
const wallet = new Wallet(
Expand Down