Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: empty REST chain-id #1146

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth/types/txbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
gas: client.GasFlagVar.Gas,
gasAdjustment: viper.GetFloat64(client.FlagGasAdjustment),
simulateAndExecute: client.GasFlagVar.Simulate,
chainID: viper.GetString(client.FlagChainID),
chainID: viper.GetString(client.FlagChain),

Check failure on line 75 in auth/types/txbuilder.go

View workflow job for this annotation

GitHub Actions / lint

undefined: client.FlagChain) (typecheck)

Check failure on line 75 in auth/types/txbuilder.go

View workflow job for this annotation

GitHub Actions / lint

undefined: client.FlagChain) (typecheck)

Check failure on line 75 in auth/types/txbuilder.go

View workflow job for this annotation

GitHub Actions / lint

undefined: client.FlagChain) (typecheck)

Check failure on line 75 in auth/types/txbuilder.go

View workflow job for this annotation

GitHub Actions / lint

undefined: client.FlagChain) (typecheck)

Check failure on line 75 in auth/types/txbuilder.go

View workflow job for this annotation

GitHub Actions / lint

undefined: client.FlagChain) (typecheck)

Check failure on line 75 in auth/types/txbuilder.go

View workflow job for this annotation

GitHub Actions / build

undefined: client.FlagChain

Check failure on line 75 in auth/types/txbuilder.go

View workflow job for this annotation

GitHub Actions / test

undefined: client.FlagChain
memo: viper.GetString(client.FlagMemo),
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/heimdallcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func main() {
// with the cdc.

// chain id
rootCmd.PersistentFlags().String(client.FlagChainID, "", "Chain ID of tendermint node")
rootCmd.PersistentFlags().String(client.FlagChain, "", "Chain of tendermint node")

helper.DecorateWithHeimdallFlags(rootCmd, viper.GetViper(), logger, "main")

Expand Down Expand Up @@ -207,7 +207,7 @@ func exportCmd(ctx *server.Context, _ *codec.Codec) *cobra.Command {
config.SetRoot(viper.GetString(cli.HomeFlag))

// create chain id
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(client.FlagChain)
if chainID == "" {
chainID = fmt.Sprintf("heimdall-%v", common.RandStr(6))
}
Expand All @@ -234,7 +234,7 @@ func exportCmd(ctx *server.Context, _ *codec.Codec) *cobra.Command {
}
cmd.Flags().String(cli.HomeFlag, helper.DefaultNodeHome, "Node's home directory")
cmd.Flags().String(helper.FlagClientHome, helper.DefaultCLIHome, "Client's home directory")
cmd.Flags().String(client.FlagChainID, "", "Genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(client.FlagChain, "", "Genesis file chain, if left blank will be randomly created")

return cmd
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/heimdalld/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func initCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, _ []string) error {
initConfig := &initHeimdallConfig{
chainID: viper.GetString(client.FlagChainID),
chainID: viper.GetString(client.FlagChain),
chain: viper.GetString(helper.ChainFlag),
validatorID: viper.GetInt64(stakingcli.FlagValidatorID),
clientHome: viper.GetString(helper.FlagClientHome),
Expand All @@ -186,7 +186,7 @@ func initCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {

cmd.Flags().String(cli.HomeFlag, helper.DefaultNodeHome, "Node's home directory")
cmd.Flags().String(helper.FlagClientHome, helper.DefaultCLIHome, "Client's home directory")
cmd.Flags().String(client.FlagChainID, "", "Genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(client.FlagChain, "", "Genesis file chain, if left blank will be randomly created")
cmd.Flags().Int(stakingcli.FlagValidatorID, 1, "--id=<validator ID here>, if left blank will be assigned 1")
cmd.Flags().Bool(helper.OverwriteGenesisFlag, false, "Overwrite the genesis.json file if it exists")

Expand Down
2 changes: 1 addition & 1 deletion cmd/heimdalld/service/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ application.

cmd.Flags().String(cli.HomeFlag, helper.DefaultNodeHome, "Node's home directory")
cmd.Flags().String(helper.FlagClientHome, helper.DefaultCLIHome, "Client's home directory")
cmd.Flags().String(client.FlagChainID, "", "Genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(client.FlagChain, "", "Genesis file chain, if left blank will be randomly created")
cmd.Flags().Int(stakingcli.FlagValidatorID, 1, "--id=<validator ID here>, if left blank will be assigned 1")

return cmd
Expand Down
4 changes: 2 additions & 2 deletions cmd/heimdalld/service/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ testnet --v 4 --n 8 --output-dir ./output --starting-ip-address 192.168.10.2
outDir := viper.GetString(flagOutputDir)

// create chain id
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(client.FlagChain)
if chainID == "" {
chainID = fmt.Sprintf("heimdall-%v", common.RandStr(6))
}
Expand Down Expand Up @@ -239,7 +239,7 @@ testnet --v 4 --n 8 --output-dir ./output --starting-ip-address 192.168.10.2
cmd.Flags().String(flagNodeHostPrefix, "node",
"Hostname prefix (node results in persistent peers list ID0@node0:26656, ID1@node1:26656, ...)")

cmd.Flags().String(client.FlagChainID, "", "Genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(client.FlagChain, "", "Genesis file chain, if left blank will be randomly created")
cmd.Flags().Bool("signer-dump", true, "Dumps all signer information in a json file")

return cmd
Expand Down
4 changes: 2 additions & 2 deletions packaging/deb/heimdalld/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Section: develop
Priority: Testing
Maintainer: Polygon <team@polygon.technology>
Build-Depends: debhelper-compat (= 13)
Standards-Version: v1.0.3-amoy-2
Standards-Version: v1.0.4
Homepage: https://polygon.technology
Rules-Requires-Root: no
Package: heimdalld
Version: 1.0.3-amoy-2
Version: 1.0.4
Architecture: amd64
Multi-Arch: foreign
Depends:
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld
Version: 1.0.3-amoy-2
Version: 1.0.4
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld
Version: 1.0.3-amoy-2
Version: 1.0.4
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.amd64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.4
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.4
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
4 changes: 2 additions & 2 deletions packaging/templates/package_scripts/control.validator
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Section: develop
Priority: Testing
Maintainer: Polygon <team@polygon.technology>
Build-Depends: debhelper-compat (= 13)
Standards-Version: v1.0.3-amoy-2
Standards-Version: v1.0.4
Homepage: https://polygon.technology
Rules-Requires-Root: no
Package: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.4
Architecture: amd64
Multi-Arch: foreign
Depends: rabbitmq-server
Expand Down
4 changes: 2 additions & 2 deletions packaging/templates/package_scripts/control.validator.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Section: develop
Priority: Testing
Maintainer: Polygon <team@polygon.technology>
Build-Depends: debhelper-compat (= 13)
Standards-Version: v1.0.3-amoy-2
Standards-Version: v1.0.4
Homepage: https://polygon.technology
Rules-Requires-Root: no
Package: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.4
Architecture: arm64
Multi-Arch: foreign
Depends: rabbitmq-server
Expand Down
5 changes: 2 additions & 3 deletions server/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/go-kit/log"
Expand Down Expand Up @@ -76,7 +75,7 @@ func StartRestServer(mainCtx ctx.Context, cdc *codec.Codec, registerRoutesFn fun
logger.Info(
fmt.Sprintf(
"Starting application REST service (chain-id: %q)...",
viper.GetString(flags.FlagChainID),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this value comes from our fork of cosmos-sdk.
I'd probably change the flag value here and raise a PR against maticnetwork/cosmos-sdk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That actually came to my mind too, but didn't want to touch that repo. Btw, let's close this PR once that sdk is modified since that already fixes the issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mrostamii, would you be raising the PR on our cosmos fork ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcello33 @Raneet10 Maybe better to change FlagChainID to FlagChain in both repositories? Tested locally and it was fine, but not sure if it's an accepted strategy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that sounds good, please proceed @mrostamii

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mrostamii any update on this? Also, please change target branch to develop. Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrostamii once the cosmos PR is merged, the version in heimdall should be updated with a new release and this field flags.FlagChainID (now changed to string "chain") needs to be updated to flags.FlagChain

viper.GetString("chain"),
),
)

Expand Down Expand Up @@ -251,7 +250,7 @@ func DecorateWithRestFlags(cmd *cobra.Command) {
cmd.Flags().Uint(FlagRPCReadHeaderTimeout, 10, "The RPC header read timeout (in seconds)")
cmd.Flags().Uint(client.FlagRPCWriteTimeout, 10, "The RPC write timeout (in seconds)")
// heimdall specific flags for rest server start
cmd.Flags().String(client.FlagChainID, "", "The chain ID to connect to")
cmd.Flags().String(client.FlagChain, "", "The chain to connect to")
cmd.Flags().String(client.FlagNode, helper.DefaultTendermintNode, "Address of the node to connect to")
// heimdall specific flags for gRPC server start
cmd.Flags().String(FlagGrpcAddr, "0.0.0.0:3132", "The address for the gRPC server to listen on")
Expand Down
Loading