Skip to content

Commit

Permalink
feat: added gas multiplier arg for injective (#2104)
Browse files Browse the repository at this point in the history
* feat: added gas multiplier arg for injective

* chore: update default gas price

* chore: bump version

---------

Co-authored-by: Ali Behjati <[email protected]>
  • Loading branch information
bangjelkoski and ali-bahjati authored Nov 11, 2024
1 parent c4774b0 commit f1c8493
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
3 changes: 2 additions & 1 deletion apps/price_pusher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ pnpm run start injective --grpc-endpoint https://grpc-endpoint.com \
--price-config-file "path/to/price-config.beta.sample.yaml" \
--mnemonic-file "path/to/mnemonic.txt" \
--network testnet \
[--gas-price 500000000] \
[--gas-price 160000000] \
[--gas-multiplier 1.1] \
[--pushing-frequency 10] \
[--polling-frequency 5]
Expand Down
2 changes: 1 addition & 1 deletion apps/price_pusher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/price-pusher",
"version": "8.0.4",
"version": "8.1.0",
"description": "Pyth Price Pusher",
"homepage": "https://pyth.network",
"main": "lib/index.js",
Expand Down
6 changes: 6 additions & 0 deletions apps/price_pusher/src/injective/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export default {
description: "Gas price to be used for each transasction",
type: "number",
} as Options,
"gas-multiplier": {
description: "Gas multiplier to be used for each transasction",
type: "number",
} as Options,
...options.priceConfigFile,
...options.priceServiceEndpoint,
...options.mnemonicFile,
Expand All @@ -44,6 +48,7 @@ export default {
// FIXME: type checks for this
const {
gasPrice,
gasMultiplier,
grpcEndpoint,
priceConfigFile,
priceServiceEndpoint,
Expand Down Expand Up @@ -101,6 +106,7 @@ export default {
{
chainId: getNetworkInfo(network).chainId,
gasPrice,
gasMultiplier,
}
);

Expand Down
8 changes: 5 additions & 3 deletions apps/price_pusher/src/injective/injective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import {
import { Logger } from "pino";
import { Account } from "@injectivelabs/sdk-ts/dist/cjs/client/chain/types/auth";

const DEFAULT_GAS_PRICE = 500000000;
const DEFAULT_GAS_PRICE = 160000000;
const DEFAULT_GAS_MULTIPLIER = 1.05;
const INJECTIVE_TESTNET_CHAIN_ID = "injective-888";

type PriceQueryResponse = {
price_feed: {
Expand Down Expand Up @@ -108,8 +110,8 @@ export class InjectivePricePusher implements IPricePusher {
this.wallet = PrivateKey.fromMnemonic(mnemonic);

this.chainConfig = {
chainId: chainConfig?.chainId ?? "injective-888",
gasMultiplier: chainConfig?.gasMultiplier ?? 1.2,
chainId: chainConfig?.chainId ?? INJECTIVE_TESTNET_CHAIN_ID,
gasMultiplier: chainConfig?.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER,
gasPrice: chainConfig?.gasPrice ?? DEFAULT_GAS_PRICE,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from "@injectivelabs/networks";
import * as net from "net";

const DEFAULT_GAS_PRICE = 500000000;
const DEFAULT_GAS_PRICE = 160000000;

export class InjectiveExecutor implements ChainExecutor {
private readonly gasMultiplier = 2;
Expand Down
6 changes: 3 additions & 3 deletions target_chains/cosmwasm/tools/src/ci/deployer/injective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export class InjectiveDeployer implements Deployer {
const txResponse = await this.signAndBroadcastMsg(store_code, {
amount: [
{
// gas = 5000000 & gasPrice = 500000000
amount: String(500000000 * 5000000),
// gas = 5000000 & gasPrice = 160000000
amount: String(160000000 * 5000000),
denom: "inj",
},
],
// DEFAULT STD FEE that we use has gas = 400000 and gasPrice = 500000000
// DEFAULT STD FEE that we use has gas = 400000 and gasPrice = 160000000
// But this transaction was taking gas around 3000000. Which is a lot more
// Keeping the gasPrice same as in default std fee as seen above in amount.
// Changing the gasLimit to 5000000
Expand Down

0 comments on commit f1c8493

Please sign in to comment.