From 4f5a5f68076b899241e8600acefe57f8c665bb0a Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Sat, 3 Feb 2024 13:35:55 -0500 Subject: [PATCH] feat: include `--gas=auto --gas-adjustment=1.3` flags in agd.tx --- packages/synthetic-chain/src/lib/agd-lib.ts | 5 ++++- packages/synthetic-chain/src/lib/cliHelper.js | 9 ++++++++- packages/synthetic-chain/src/lib/commonUpgradeHelpers.js | 3 --- packages/synthetic-chain/src/lib/core-eval.ts | 3 +-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/synthetic-chain/src/lib/agd-lib.ts b/packages/synthetic-chain/src/lib/agd-lib.ts index 68afb7c5..412f68ec 100644 --- a/packages/synthetic-chain/src/lib/agd-lib.ts +++ b/packages/synthetic-chain/src/lib/agd-lib.ts @@ -77,7 +77,8 @@ export const makeAgd = ({ }); const rw = freeze({ /** - * TODO: gas + * @param {string[]} txArgs + * @param {{ chainId: string, from: string, yes?: boolean }} opts */ tx: async ( txArgs: string[], @@ -95,6 +96,8 @@ export const makeAgd = ({ ...[`--from`, from], 'tx', ...['--broadcast-mode', 'block'], + ...['--gas', 'auto'], + ...['--gas-adjustment', '1.3'], ...txArgs, ...yesArg, ...outJson, diff --git a/packages/synthetic-chain/src/lib/cliHelper.js b/packages/synthetic-chain/src/lib/cliHelper.js index cc56d473..98f0e666 100644 --- a/packages/synthetic-chain/src/lib/cliHelper.js +++ b/packages/synthetic-chain/src/lib/cliHelper.js @@ -16,7 +16,14 @@ export const agd = { return JSON.parse(data); }, tx: async (...params) => { - const newParams = ['tx', '-bblock', ...params, '-o json']; + const newParams = [ + 'tx', + '-bblock', + '--gas auto', + '--gas-adjustment 1.3', + ...params, + '-o json', + ]; const data = await executeCommand(BINARY, newParams, { shell: true }); return JSON.parse(data); }, diff --git a/packages/synthetic-chain/src/lib/commonUpgradeHelpers.js b/packages/synthetic-chain/src/lib/commonUpgradeHelpers.js index c1bf17f4..39e818bd 100644 --- a/packages/synthetic-chain/src/lib/commonUpgradeHelpers.js +++ b/packages/synthetic-chain/src/lib/commonUpgradeHelpers.js @@ -248,7 +248,6 @@ export const installBundle = async (addr, bundlePath) => { '--from', addr, '--keyring-backend=test', - '--gas=auto', '--chain-id', CHAINID, '-bblock', @@ -274,8 +273,6 @@ export const submitProposal = async ( '--from', VALIDATORADDR, '--keyring-backend=test', - '--gas=auto', - '--gas-adjustment=1.2', '--chain-id', CHAINID, '-bblock', diff --git a/packages/synthetic-chain/src/lib/core-eval.ts b/packages/synthetic-chain/src/lib/core-eval.ts index 5a390f8e..a60d4ecb 100644 --- a/packages/synthetic-chain/src/lib/core-eval.ts +++ b/packages/synthetic-chain/src/lib/core-eval.ts @@ -194,7 +194,7 @@ export const passCoreEvalProposal = async ( const bundleRd = await bundleAssets.storedPath(fileName); const result = await agd.tx( - ['swingset', 'install-bundle', `@${bundleRd}`, '--gas', 'auto'], + ['swingset', 'install-bundle', `@${bundleRd}`], { from, chainId, yes: true }, ); console.log(txAbbr(result)); @@ -248,7 +248,6 @@ export const passCoreEvalProposal = async ( 'swingset-core-eval', ...evalPaths, ...flags({ ...info, deposit }), - ...flags({ gas: 'auto', 'gas-adjustment': '1.2' }), ], { from, chainId, yes: true }, );