From 8e2dd1773312d77ae4e3b9caaafcf8bb9ec23cc2 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 11 May 2022 11:36:33 +0200 Subject: [PATCH] fix: configurage gas_multiplier --- cli/lib/constants.mjs | 2 ++ cli/lib/nf3.mjs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/lib/constants.mjs b/cli/lib/constants.mjs index b19948929..79937d094 100644 --- a/cli/lib/constants.mjs +++ b/cli/lib/constants.mjs @@ -19,3 +19,5 @@ export const DEFAULT_PROPOSER_BOND = 10; export const DEFAULT_BLOCK_STAKE = 1; export const WEBSOCKET_PING_TIME = 15000; + +export const GAS_MULTIPLIER = Number(process.env.GAS_MULTIPLIER) || 2; diff --git a/cli/lib/nf3.mjs b/cli/lib/nf3.mjs index 6286692b3..cc0b70c8f 100644 --- a/cli/lib/nf3.mjs +++ b/cli/lib/nf3.mjs @@ -15,6 +15,7 @@ import { DEFAULT_PROPOSER_BOND, DEFAULT_FEE, WEBSOCKET_PING_TIME, + GAS_MULTIPLIER, } from './constants.mjs'; // TODO when SDK is refactored such that these functions are split by user, proposer and challenger, @@ -221,7 +222,7 @@ class Nf3 { // this.nonce = await this.web3.eth.getTransactionCount(this.ethereumAddress, 'pending'); let gasPrice = 20000000000; const gas = (await this.web3.eth.getBlock('latest')).gasLimit; - const blockGasPrice = 2 * Number(await this.web3.eth.getGasPrice()); + const blockGasPrice = GAS_MULTIPLIER * Number(await this.web3.eth.getGasPrice()); if (blockGasPrice > gasPrice) gasPrice = blockGasPrice; const tx = {