Browse Source

feat: added gas multiplier arg for injective (#2104)

* feat: added gas multiplier arg for injective

* chore: update default gas price

* chore: bump version

---------

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
Bojan Angjelkoski 1 year ago
parent
commit
f1c8493118

+ 2 - 1
apps/price_pusher/README.md

@@ -105,7 +105,8 @@ pnpm run start injective --grpc-endpoint https://grpc-endpoint.com \
     --price-config-file "path/to/price-config.beta.sample.yaml" \
     --price-config-file "path/to/price-config.beta.sample.yaml" \
     --mnemonic-file "path/to/mnemonic.txt" \
     --mnemonic-file "path/to/mnemonic.txt" \
     --network testnet \
     --network testnet \
-    [--gas-price 500000000] \
+    [--gas-price 160000000] \
+    [--gas-multiplier 1.1] \
     [--pushing-frequency 10] \
     [--pushing-frequency 10] \
     [--polling-frequency 5]
     [--polling-frequency 5]
 
 

+ 1 - 1
apps/price_pusher/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@pythnetwork/price-pusher",
   "name": "@pythnetwork/price-pusher",
-  "version": "8.0.4",
+  "version": "8.1.0",
   "description": "Pyth Price Pusher",
   "description": "Pyth Price Pusher",
   "homepage": "https://pyth.network",
   "homepage": "https://pyth.network",
   "main": "lib/index.js",
   "main": "lib/index.js",

+ 6 - 0
apps/price_pusher/src/injective/command.ts

@@ -30,6 +30,10 @@ export default {
       description: "Gas price to be used for each transasction",
       description: "Gas price to be used for each transasction",
       type: "number",
       type: "number",
     } as Options,
     } as Options,
+    "gas-multiplier": {
+      description: "Gas multiplier to be used for each transasction",
+      type: "number",
+    } as Options,
     ...options.priceConfigFile,
     ...options.priceConfigFile,
     ...options.priceServiceEndpoint,
     ...options.priceServiceEndpoint,
     ...options.mnemonicFile,
     ...options.mnemonicFile,
@@ -44,6 +48,7 @@ export default {
     // FIXME: type checks for this
     // FIXME: type checks for this
     const {
     const {
       gasPrice,
       gasPrice,
+      gasMultiplier,
       grpcEndpoint,
       grpcEndpoint,
       priceConfigFile,
       priceConfigFile,
       priceServiceEndpoint,
       priceServiceEndpoint,
@@ -101,6 +106,7 @@ export default {
       {
       {
         chainId: getNetworkInfo(network).chainId,
         chainId: getNetworkInfo(network).chainId,
         gasPrice,
         gasPrice,
+        gasMultiplier,
       }
       }
     );
     );
 
 

+ 5 - 3
apps/price_pusher/src/injective/injective.ts

@@ -22,7 +22,9 @@ import {
 import { Logger } from "pino";
 import { Logger } from "pino";
 import { Account } from "@injectivelabs/sdk-ts/dist/cjs/client/chain/types/auth";
 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 = {
 type PriceQueryResponse = {
   price_feed: {
   price_feed: {
@@ -108,8 +110,8 @@ export class InjectivePricePusher implements IPricePusher {
     this.wallet = PrivateKey.fromMnemonic(mnemonic);
     this.wallet = PrivateKey.fromMnemonic(mnemonic);
 
 
     this.chainConfig = {
     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,
       gasPrice: chainConfig?.gasPrice ?? DEFAULT_GAS_PRICE,
     };
     };
   }
   }

+ 1 - 1
target_chains/cosmwasm/tools/src/chains-manager/injective.ts

@@ -34,7 +34,7 @@ import {
 } from "@injectivelabs/networks";
 } from "@injectivelabs/networks";
 import * as net from "net";
 import * as net from "net";
 
 
-const DEFAULT_GAS_PRICE = 500000000;
+const DEFAULT_GAS_PRICE = 160000000;
 
 
 export class InjectiveExecutor implements ChainExecutor {
 export class InjectiveExecutor implements ChainExecutor {
   private readonly gasMultiplier = 2;
   private readonly gasMultiplier = 2;

+ 3 - 3
target_chains/cosmwasm/tools/src/ci/deployer/injective.ts

@@ -87,12 +87,12 @@ export class InjectiveDeployer implements Deployer {
     const txResponse = await this.signAndBroadcastMsg(store_code, {
     const txResponse = await this.signAndBroadcastMsg(store_code, {
       amount: [
       amount: [
         {
         {
-          // gas = 5000000 & gasPrice = 500000000
-          amount: String(500000000 * 5000000),
+          // gas = 5000000 & gasPrice = 160000000
+          amount: String(160000000 * 5000000),
           denom: "inj",
           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
       // 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.
       // Keeping the gasPrice same as in default std fee as seen above in amount.
       // Changing the gasLimit to 5000000
       // Changing the gasLimit to 5000000