Skip to content

Commit

Permalink
feat: include --gas=auto --gas-adjustment=1.3 flags in agd.tx
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Feb 9, 2024
1 parent 796d2e7 commit 4f5a5f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion packages/synthetic-chain/src/lib/agd-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[],
Expand All @@ -95,6 +96,8 @@ export const makeAgd = ({
...[`--from`, from],
'tx',
...['--broadcast-mode', 'block'],
...['--gas', 'auto'],
...['--gas-adjustment', '1.3'],
...txArgs,
...yesArg,
...outJson,
Expand Down
9 changes: 8 additions & 1 deletion packages/synthetic-chain/src/lib/cliHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
3 changes: 0 additions & 3 deletions packages/synthetic-chain/src/lib/commonUpgradeHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ export const installBundle = async (addr, bundlePath) => {
'--from',
addr,
'--keyring-backend=test',
'--gas=auto',
'--chain-id',
CHAINID,
'-bblock',
Expand All @@ -274,8 +273,6 @@ export const submitProposal = async (
'--from',
VALIDATORADDR,
'--keyring-backend=test',
'--gas=auto',
'--gas-adjustment=1.2',
'--chain-id',
CHAINID,
'-bblock',
Expand Down
3 changes: 1 addition & 2 deletions packages/synthetic-chain/src/lib/core-eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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 },
);
Expand Down

0 comments on commit 4f5a5f6

Please sign in to comment.