Skip to content

Commit

Permalink
Merge pull request #2676 from OriginTrail/improvement/fixed-gas-limit…
Browse files Browse the repository at this point in the history
…-removal

Removed fixed gas limit for blockchain functions
  • Loading branch information
NZT48 authored Sep 7, 2023
2 parents 40c317c + 6055570 commit 8fa0308
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
6 changes: 0 additions & 6 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,6 @@ export const CONTRACT_EVENT_FETCH_INTERVALS = {
DEVELOPMENT: 4 * 1000,
};

export const FIXED_GAS_LIMIT_METHODS = {
submitCommit: 600000,
submitUpdateCommit: 600000,
sendProof: 500000,
};

export const BLOCK_TIME_MILLIS = {
OTP: 12_000,
HARDHAT: 5_000,
Expand Down
10 changes: 1 addition & 9 deletions src/modules/blockchain/implementation/web3-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
DEFAULT_BLOCKCHAIN_EVENT_SYNC_PERIOD_IN_MILLS,
MAXIMUM_NUMBERS_OF_BLOCKS_TO_FETCH,
TRANSACTION_QUEUE_CONCURRENCY,
FIXED_GAS_LIMIT_METHODS,
TRANSACTION_POLLING_TIMEOUT_MILLIS,
TRANSACTION_CONFIRMATIONS,
BLOCK_TIME_MILLIS,
Expand Down Expand Up @@ -348,14 +347,7 @@ class Web3Service {
while (result === undefined) {
try {
/* eslint-disable no-await-in-loop */
let gasLimit;

if (FIXED_GAS_LIMIT_METHODS[functionName]) {
gasLimit = FIXED_GAS_LIMIT_METHODS[functionName];
} else {
gasLimit = await contractInstance.estimateGas[functionName](...args);
}

const gasLimit = await contractInstance.estimateGas[functionName](...args);
const gas = gasLimit ?? this.convertToWei(900, 'kwei');

this.logger.info(
Expand Down

0 comments on commit 8fa0308

Please sign in to comment.