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

Configurable gas_multiplier #654

Merged
merged 1 commit into from
May 11, 2022
Merged
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
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