diff --git a/axelar-chains-config/info/testnet.json b/axelar-chains-config/info/testnet.json index 0d5da367..870a2f72 100644 --- a/axelar-chains-config/info/testnet.json +++ b/axelar-chains-config/info/testnet.json @@ -1125,7 +1125,8 @@ }, "confirmations": 2, "gasOptions": { - "gasLimit": 7000000 + "gasLimit": 7000000, + "gasPriceAdjustment": 1.5 }, "onchainGasEstimate": { "l1ChainName": "ethereum", diff --git a/evm/gas-service.js b/evm/gas-service.js index 04c27be2..6eef38d7 100644 --- a/evm/gas-service.js +++ b/evm/gas-service.js @@ -312,7 +312,11 @@ async function processCommand(config, chain, options) { printInfo('TX', tx.hash); - const receipt = await tx.wait(chain.confirmations); + const receipt = await timeout( + tx.wait(chain.confirmations), + chain.timeout || 60000, + new Error(`Timeout updating gas info for ${chain.name}`), + ); const eventEmitted = wasEventEmitted(receipt, gasService, 'GasInfoUpdated'); diff --git a/evm/operators.js b/evm/operators.js index a5c5d818..fc2a8838 100644 --- a/evm/operators.js +++ b/evm/operators.js @@ -274,7 +274,12 @@ async function processCommand(config, chain, options) { new Error(`Timeout updating gas info for ${chain.name}`), ); printInfo('TX', tx.hash); - await tx.wait(chain.confirmations); + + await timeout( + tx.wait(chain.confirmations), + chain.timeout || 60000, + new Error(`Timeout updating gas info for ${chain.name}`), + ); } catch (error) { for (let i = 0; i < chainsToUpdate.length; i++) { addFailedChainUpdate(chain.name, chainsToUpdate[i]); diff --git a/evm/utils.js b/evm/utils.js index e49527c8..aa6f7985 100644 --- a/evm/utils.js +++ b/evm/utils.js @@ -1179,9 +1179,14 @@ function toBigNumberString(number) { function timeout(prom, time, exception) { let timer; - return Promise.race([prom, new Promise((resolve, reject) => (timer = setTimeout(reject, time, exception)))]).finally(() => - clearTimeout(timer), - ); + + // Racing the promise with a timer + // If the timer resolves first, the promise is rejected with the exception + const race = Promise.race([prom, new Promise((resolve, reject) => (timer = setTimeout(reject, time, exception)))]); + + race.finally(() => clearTimeout(timer)); + + return race; } module.exports = {