Skip to content

Commit

Permalink
Merge pull request #654 from EYBlockchain/david/gas-multiplier
Browse files Browse the repository at this point in the history
Configurable gas_multiplier
  • Loading branch information
Westlad authored May 11, 2022
2 parents b8c4482 + 8e2dd17 commit fc26950
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cli/lib/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 2 additions & 1 deletion cli/lib/nf3.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit fc26950

Please sign in to comment.