diff --git a/axelar-chains-config/info/testnet.json b/axelar-chains-config/info/testnet.json index d2b17d80..c3a5f932 100644 --- a/axelar-chains-config/info/testnet.json +++ b/axelar-chains-config/info/testnet.json @@ -104,11 +104,12 @@ "gasOptions": { "gasLimit": 8000000 }, - "finality": "finalized", - "approxFinalityWaitTime": 40, "onchainGasEstimate": { + "chainName": "ethereum", "blobBaseFee": 50187563959 - } + }, + "finality": "finalized", + "approxFinalityWaitTime": 40 }, "avalanche": { "name": "Avalanche", @@ -1010,6 +1011,9 @@ "gasOptions": { "gasLimit": 300000000 }, + "onchainGasEstimate": { + "chainName": "filecoin" + }, "confirmations": 3, "eip1559": true, "finality": "120", @@ -1125,6 +1129,9 @@ "gasOptions": { "gasPrice": 3000000000 }, + "onchainGasEstimate": { + "l1ChainName": "ethereum" + }, "confirmations": 4, "finality": "400", "approxFinalityWaitTime": 30 @@ -1238,6 +1245,9 @@ "gasLimit": 7000000, "gasPriceAdjustment": 0.25 }, + "onchainGasEstimate": { + "l1ChainName": "ethereum" + }, "finality": "finalized", "approxFinalityWaitTime": 60 }, @@ -1438,7 +1448,11 @@ "api": "https://api-sepolia.arbiscan.io/api" }, "finality": "finalized", - "approxFinalityWaitTime": 25 + "approxFinalityWaitTime": 25, + "onchainGasEstimate": { + "chainName": "arbitrum", + "l1ChainName": "ethereum" + } }, "centrifuge": { "name": "Centrifuge", @@ -1541,6 +1555,10 @@ "gasOptions": { "gasLimit": 8000000 }, + "onchainGasEstimate": { + "l1ChainName": "ethereum", + "gasEstimationType": 1 + }, "contracts": { "InterchainGovernance": { "minimumTimeDelay": 300, @@ -1874,6 +1892,11 @@ "gasOptions": { "gasLimit": 8000000 }, + "onchainGasEstimate": { + "chainName": "blast", + "l1ChainName": "ethereum", + "gasEstimationType": 1 + }, "confirmations": 2, "explorer": { "name": "Blastscan", @@ -1983,6 +2006,11 @@ "gasOptions": { "gasLimit": 50000000000 }, + "onchainGasEstimate": { + "chainName": "mantle", + "l1ChainName": "ethereum", + "gasEstimationType": 1 + }, "explorer": { "name": "Mantle Explorer", "url": "https://explorer.sepolia.mantle.xyz", diff --git a/evm/gas-service.js b/evm/gas-service.js index f33434ce..96c283eb 100644 --- a/evm/gas-service.js +++ b/evm/gas-service.js @@ -27,6 +27,26 @@ const { getWallet } = require('./sign-utils'); let failedChainUpdates = []; +function addFailedChainUpdate(chain, destinationChain) { + failedChainUpdates.push({ chain, destinationChain }); +} + +function printFailedChainUpdates() { + if (failedChainUpdates.length > 0) { + printError('Failed to update gas info for following chain combinations'); + + failedChainUpdates.forEach(({ chain, destinationChain }) => { + printError(`${chain} -> ${destinationChain}`); + }); + + failedChainUpdates = []; + + throw new Error('Failed to update gas info for the chain combinations above'); + } + + failedChainUpdates = []; +} + async function getGasUpdates(config, env, chain, destinationChains) { const api = config.axelar.axelarscanApi; @@ -62,7 +82,7 @@ async function getGasUpdates(config, env, chain, destinationChains) { } catch (e) { printError(`Error getting gas info for ${chain.axelarId} -> ${axelarId}`); printError(e); - failedChainUpdates.push({ chain: chain.axelarId, destinationChain: axelarId }); + addFailedChainUpdate(chain.axelarId, axelarId); return null; } @@ -134,18 +154,6 @@ async function getGasUpdates(config, env, chain, destinationChains) { }; } -function printFailedChainUpdates() { - if (failedChainUpdates.length > 0) { - printError('Failed to update gas info for following chain combinations'); - - failedChainUpdates.forEach(({ chain, destinationChain }) => { - printError(`${chain} -> ${destinationChain}`); - }); - } - - failedChainUpdates = []; -} - async function processCommand(config, chain, options) { const { env, contractName, address, action, privateKey, chains, destinationChain, destinationAddress, isExpress, yes } = options; const executionGasLimit = parseInt(options.executionGasLimit); @@ -235,16 +243,25 @@ async function processCommand(config, chain, options) { return; } - const tx = await gasService.updateGasInfo(chainsToUpdate, gasInfoUpdates, gasOptions); + try { + const tx = await gasService.updateGasInfo(chainsToUpdate, gasInfoUpdates, gasOptions); + + printInfo('TX', tx.hash); - printInfo('TX', tx.hash); + const receipt = await tx.wait(chain.confirmations); - const receipt = await tx.wait(chain.confirmations); + const eventEmitted = wasEventEmitted(receipt, gasService, 'GasInfoUpdated'); - const eventEmitted = wasEventEmitted(receipt, gasService, 'GasInfoUpdated'); + if (!eventEmitted) { + printWarn('Event not emitted in receipt.'); + } + } + catch (error) { + for (let i = 0; i < chainsToUpdate.length; i++) { + addFailedChainUpdate(chain.name, chainsToUpdate[i]); + } - if (!eventEmitted) { - printWarn('Event not emitted in receipt.'); + printError(error); } break; @@ -293,4 +310,5 @@ if (require.main === module) { } exports.getGasUpdates = getGasUpdates; +exports.addFailedChainUpdate = addFailedChainUpdate; exports.printFailedChainUpdates = printFailedChainUpdates; diff --git a/evm/operators.js b/evm/operators.js index 65505ee4..b6243efe 100644 --- a/evm/operators.js +++ b/evm/operators.js @@ -24,7 +24,7 @@ const { getContractJSON, } = require('./utils'); const { addBaseOptions } = require('./cli-utils'); -const { getGasUpdates, printFailedChainUpdates } = require('./gas-service'); +const { getGasUpdates, printFailedChainUpdates, addFailedChainUpdate } = require('./gas-service'); async function processCommand(config, chain, options) { const { @@ -264,7 +264,12 @@ async function processCommand(config, chain, options) { const tx = await operatorsContract.executeContract(target, updateGasInfoCalldata, 0, gasOptions); printInfo('TX', tx.hash); await tx.wait(chain.confirmations); - } catch (error) { + } + catch (error) { + for (let i = 0; i < chainsToUpdate.length; i++) { + addFailedChainUpdate(chain.name, chainsToUpdate[i]); + } + printError(error); }