From 7a36255cd5d7f6d9188ed4c84a1b0e5a26cdaa48 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Mon, 20 May 2024 14:55:52 +0800 Subject: [PATCH] Configure the gas price which used by DA helper through parameters. --- helper/da/main.go | 2 ++ helper/da/service/handler.go | 6 +++++- helper/da/types/keys.go | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/helper/da/main.go b/helper/da/main.go index 247f4e16..4e41ec55 100644 --- a/helper/da/main.go +++ b/helper/da/main.go @@ -29,6 +29,7 @@ var ( account = flag.String("account", "", "account to run evmosd cli") keyring = flag.String("keyring", "", "keyring to run evmosd cli") homePath = flag.String("home", "", "home path of evmosd node") + gasPrice = flag.String("gas-price", "", "gas price to run evmosd cli") ) func newUpgrader() *websocket.Upgrader { @@ -40,6 +41,7 @@ func newUpgrader() *websocket.Upgrader { ctx = context.WithValue(ctx, types.NODE_CLI_EXEC_ACCOUNT, *account) ctx = context.WithValue(ctx, types.NODE_CLI_EXEC_KEYRING, *keyring) ctx = context.WithValue(ctx, types.NODE_HOME_PATH, *homePath) + ctx = context.WithValue(ctx, types.NODE_GAS_PRICE, *gasPrice) go func() { service.OnMessage(ctx, c, messageType, data) }() }) diff --git a/helper/da/service/handler.go b/helper/da/service/handler.go index 5a379bc8..19a89707 100644 --- a/helper/da/service/handler.go +++ b/helper/da/service/handler.go @@ -165,7 +165,6 @@ func runEvmosdCliReportDasResult(ctx context.Context, requestId uint64, result b strconv.FormatUint(requestId, 10), strconv.FormatBool(result), "--from", account.(string), - "--gas-prices", "7678500neuron", // TODO: use args to set gas prices } homePath := ctx.Value(types.NODE_HOME_PATH) @@ -178,6 +177,11 @@ func runEvmosdCliReportDasResult(ctx context.Context, requestId uint64, result b args = append(args, "--keyring-backend", keyring.(string)) } + gasPrice := ctx.Value(types.NODE_GAS_PRICE) + if len(gasPrice.(string)) > 0 { + args = append(args, "--gas-prices", gasPrice.(string)) + } + cmdStr := relativePath.(string) + "0gchaind" cmd := exec.Command(cmdStr, append(args, "-y")...) cmd.Stdout = os.Stdout diff --git a/helper/da/types/keys.go b/helper/da/types/keys.go index e824f793..e264f9ed 100644 --- a/helper/da/types/keys.go +++ b/helper/da/types/keys.go @@ -7,4 +7,5 @@ const ( NODE_CLI_EXEC_ACCOUNT = "node_exec_account" NODE_CLI_EXEC_KEYRING = "node_exec_keyring" NODE_HOME_PATH = "home_path" + NODE_GAS_PRICE = "gas_price" )