From d9d03f8fadb932b355398b198e45f0b0cbe14022 Mon Sep 17 00:00:00 2001 From: Coburn Berry <32463466+coburncoburn@users.noreply.github.com> Date: Mon, 5 Aug 2019 11:48:39 -0700 Subject: [PATCH] Coburn/debug gas limit (#23) * v1.0.11 * v1.0.12 * v1.0.13 * v1.0.14 * v1.0.15 * add gas limit option to poster * v1.0.16 * v1.0.17 * move default confirmation blocks setting above dev setting --- .build/rinkeby.json | 1 + poster/package.json | 2 +- poster/src/index.ts | 6 ++++-- poster/src/poster.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .build/rinkeby.json diff --git a/.build/rinkeby.json b/.build/rinkeby.json new file mode 100644 index 00000000..9ce78e5d --- /dev/null +++ b/.build/rinkeby.json @@ -0,0 +1 @@ +{"OpenOraclePriceData":"0xF8273110C08af3407C6aE8bF92b1f310b15D3020","DelFiPrice":"0xda1dc21e59863de6762E97135c39153865Fb02C5"} \ No newline at end of file diff --git a/poster/package.json b/poster/package.json index 3eeacd7c..f1b0e10c 100644 --- a/poster/package.json +++ b/poster/package.json @@ -1,6 +1,6 @@ { "name": "open-oracle-poster", - "version": "1.0.10", + "version": "1.0.17", "description": "A Customizable Poster for the Compound Open Oracle", "main": ".tsbuilt/poster.js", "bin": ".tsbuilt/index.js", diff --git a/poster/src/index.ts b/poster/src/index.ts index fc970516..e65230b1 100644 --- a/poster/src/index.ts +++ b/poster/src/index.ts @@ -11,7 +11,8 @@ async function run() { .option('viewAddress', {alias: 'a', description: 'Address of open oracle view to post through', type: 'string'}) .option('viewFunction', {alias: 'f', description: 'Function signature for the view', type: 'string', default: 'postPrices(bytes[],bytes[],string[])'}) .option('web3Provider', {description: 'Web 3 provider', type: 'string', default: 'http://127.0.0.1:8545'}) - .option('timeout', {alias: 't', description: 'How many seconds to wait before retrying with more gas', type: 'number', default: 180}) + .option('timeout', {alias: 't', description: 'how many seconds to wait before retrying with more gas', type: 'number', default: 180}) + .option('gasLimit', {alias: 'g', description: 'how much gas to send', type: 'number', default: 4000000}) .help() .alias('help', 'h') .demandOption(['posterKey', 'sources', 'viewFunction', 'web3Provider', 'viewAddress'], 'Provide all the arguments') @@ -20,6 +21,7 @@ async function run() { // posting promise will reject and retry once with higher gas after this timeout const web3 = await new Web3(argv.web3Provider, undefined, {transactionPollingTimeout: argv.timeout}); + web3.eth.transactionConfirmationBlocks = 10; if (argv.web3Provider.match(/.*:8545$/)) { // confirm immediately in dev web3.eth.transactionConfirmationBlocks = 1 @@ -38,7 +40,7 @@ async function run() { } try { - await main(argv.sources, argv.posterKey, argv.viewAddress, argv.viewFunction, web3); + await main(argv.sources, argv.posterKey, argv.viewAddress, argv.viewFunction, argv.gasLimit, web3); } catch (e) { console.error(`Poster failed to run`, e); } diff --git a/poster/src/poster.ts b/poster/src/poster.ts index 65236c6c..edf54279 100644 --- a/poster/src/poster.ts +++ b/poster/src/poster.ts @@ -8,6 +8,7 @@ async function main(sources : string, senderKey : string, viewAddress : string, functionSig : string, + gas: number, web3 : Web3) { const payloads = await fetchPayloads(sources.split(",")); const gasPrice = await fetchGasPrice(); @@ -17,7 +18,7 @@ async function main(sources : string, data: trxData, to: viewAddress, gasPrice: gasPrice, - gas: 1_000_000 + gas: gas } return await postWithRetries(trx, senderKey, web3);