Configure the gas price which used by DA helper through parameters.

This commit is contained in:
Solovyov1796 2024-05-20 14:55:52 +08:00
parent d6ecf1313e
commit 7a36255cd5
3 changed files with 8 additions and 1 deletions

View File

@ -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) }()
})

View File

@ -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

View File

@ -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"
)