Skip to content

Commit

Permalink
Coburn/debug gas limit (#23)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
coburncoburn authored Aug 5, 2019
1 parent e9c91d9 commit d9d03f8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .build/rinkeby.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"OpenOraclePriceData":"0xF8273110C08af3407C6aE8bF92b1f310b15D3020","DelFiPrice":"0xda1dc21e59863de6762E97135c39153865Fb02C5"}
2 changes: 1 addition & 1 deletion poster/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 4 additions & 2 deletions poster/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand All @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion poster/src/poster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit d9d03f8

Please sign in to comment.