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: nil receiver initiate for path #1177

Merged
merged 2 commits into from
Apr 26, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [\#466](https://github.com/cosmos/relayer/pull/466) Docs cleanup.
* [\#506](https://github.com/cosmos/relayer/pull/506) Fix Timeout Handling on Relayer restart
* [\#940](https://github.com/cosmos/relayer/pull/940) Add min-gas-amount parameter for chain configs, to workaround gas estimation failure.
* [\#1177](https://github.com/cosmos/relayer/pull/1177) Avoid panic due to nil map when add new path and ensure path get written to config.

## v0.9.3

Expand Down
4 changes: 2 additions & 2 deletions cmd/appstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (a *appState) addPathFromFile(ctx context.Context, stderr io.Writer, file,
return err
}

return a.config.Paths.Add(name, p)
return a.config.AddPath(name, p)
}

// addPathFromUserInput manually prompts the user to specify all the path details.
Expand Down Expand Up @@ -169,7 +169,7 @@ func (a *appState) addPathFromUserInput(
return err
}

return a.config.Paths.Add(name, path)
return a.config.AddPath(name, path)
}

func (a *appState) performConfigLockingOperation(ctx context.Context, operation func() error) error {
Expand Down
8 changes: 6 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"reflect"
"strings"
"time"

"github.com/cosmos/relayer/v2/relayer"
"github.com/cosmos/relayer/v2/relayer/chains/cosmos"
"github.com/cosmos/relayer/v2/relayer/chains/penumbra"
Expand Down Expand Up @@ -545,6 +545,10 @@ func checkPathEndConflict(pathID, direction string, oldPe, newPe *relayer.PathEn

// AddPath adds an additional path to the config
func (c *Config) AddPath(name string, path *relayer.Path) (err error) {
// Ensure path is initialized.
if c.Paths == nil {
c.Paths = make(relayer.Paths)
}
// Check if the path does not yet exist.
oldPath, err := c.Paths.Get(name)
if err != nil {
Expand Down Expand Up @@ -668,4 +672,4 @@ func (c *Config) ValidateConnection(ctx context.Context, chain *relayer.Chain, h
}

return nil
}
}
2 changes: 1 addition & 1 deletion cmd/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ $ %s pth n ibc-0 ibc-1 demo-path`, appName, appName)),
}

name := args[2]
if err = a.config.Paths.Add(name, p); err != nil {
if err = a.config.AddPath(name, p); err != nil {
return err
}
return nil
Expand Down