Skip to content

Commit

Permalink
feat: error out when home is not set (#1128)
Browse files Browse the repository at this point in the history
- Errors when `--home` is not set
- Will **not** error when `--help` is set
- Will **not** error when `--home` is set to default home
  • Loading branch information
PoisonPhang authored Jan 12, 2024
2 parents f66b176 + eec886f commit f9fea82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions networks/genesis/devnet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
CODE_HASH=$(sha256sum ${self'.packages.ucs01-relay}/lib/ucs01_relay.wasm | cut -f1 -d" ")
${uniond} query wasm build-address $CODE_HASH $ALICE_ADDRESS ${cw-instantiate2-salt} > $out/CW20_ICS20_CONTRACT_ADDRESS
${uniond} query wasm build-address $CODE_HASH $ALICE_ADDRESS ${cw-instantiate2-salt} --home $out > $out/CW20_ICS20_CONTRACT_ADDRESS
'';

calculatePingPongAddress = home: pkgs.runCommand "calculate-ping-pong-contract-address"
Expand All @@ -109,7 +109,7 @@
CODE_HASH=$(sha256sum ${self'.packages.ucs00-pingpong}/lib/ucs00_pingpong.wasm | cut -f1 -d" ")
${uniond} query wasm build-address $CODE_HASH $ALICE_ADDRESS ${cw-instantiate2-salt} > $out/PING_PONG_CONTRACT_ADDRESS
${uniond} query wasm build-address $CODE_HASH $ALICE_ADDRESS ${cw-instantiate2-salt} --home $out > $out/PING_PONG_CONTRACT_ADDRESS
'';

addIbcConnectionToGenesis = home: pkgs.runCommand "add-ibc-connection-to-genesis"
Expand Down
5 changes: 5 additions & 0 deletions uniond/cmd/uniond/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@ func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) {
Use: app.Name + "d",
Short: "Start union node",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// panic if there is no home flag
if !cmd.Flags().Changed(flags.FlagHome) {
return errors.New("before running a uniond subcommand, set the `--home` flag")
}
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
cmd.SetErr(cmd.ErrOrStderr())

initClientCtx = initClientCtx.WithCmdContext(cmd.Context())

initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags())
if err != nil {
return err
Expand Down

0 comments on commit f9fea82

Please sign in to comment.