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

Running check:construction without flags causes nil pointer dereference #269

Closed
t-hale opened this issue Jan 17, 2022 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@t-hale
Copy link
Contributor

t-hale commented Jan 17, 2022

Describe the bug
When running the check:construction command with no arguments, the CLI panics on a nil pointer dereference in https://github.com/coinbase/rosetta-cli/blob/master/pkg/results/construction_results.go#L316

To Reproduce

❯ go run main.go check:construction

Error: construction configuration is missing
github.com/coinbase/rosetta-cli/pkg/results.ExitConstruction
	/Users/tyler/Documents/github/rosetta-cli/pkg/results/construction_results.go:305
github.com/coinbase/rosetta-cli/cmd.runCheckConstructionCmd
	/Users/tyler/Documents/github/rosetta-cli/cmd/check_construction.go:58
github.com/spf13/cobra.(*Command).execute
	/Users/tyler/go/pkg/mod/github.com/spf13/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/tyler/go/pkg/mod/github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
	/Users/tyler/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/coinbase/rosetta-cli/cmd.Execute
	/Users/tyler/Documents/github/rosetta-cli/cmd/root.go:170
main.main
	/Users/tyler/Documents/github/rosetta-cli/main.go:26
runtime.main
	/usr/local/Cellar/go/1.17.5/libexec/src/runtime/proc.go:255
runtime.goexit
	/usr/local/Cellar/go/1.17.5/libexec/src/runtime/asm_amd64.s:1581

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x45442db]

goroutine 1 [running]:
github.com/coinbase/rosetta-cli/pkg/results.ExitConstruction(0xc0001d9080, 0xb, 0x6, {0x4a3ae80, 0xc00010f800})
	/Users/tyler/Documents/github/rosetta-cli/pkg/results/construction_results.go:317 +0x11b
github.com/coinbase/rosetta-cli/cmd.runCheckConstructionCmd(0x4e7cd20, {0x4832e5b, 0x0, 0x0})
	/Users/tyler/Documents/github/rosetta-cli/cmd/check_construction.go:58 +0xb5b
github.com/spf13/cobra.(*Command).execute(0x4e7cd20, {0x4ebc6b0, 0x0, 0x0})
	/Users/tyler/go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0x4e7caa0)
	/Users/tyler/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/tyler/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/coinbase/rosetta-cli/cmd.Execute()
	/Users/tyler/Documents/github/rosetta-cli/cmd/root.go:170 +0x4c
main.main()
	/Users/tyler/Documents/github/rosetta-cli/main.go:26 +0x19
exit status 2

Expected behavior
The command should print the stack trace if the configuration is missing (and they haven't disabled stack traces in their rosetta config), print the usage message, and exit with a nonzero result value

Additional context
N/A

@t-hale t-hale added the bug Something isn't working label Jan 17, 2022
t-hale added a commit to t-hale/rosetta-cli that referenced this issue Jan 17, 2022
@t-hale t-hale changed the title Running check:construction with flags causes stack trace with nil pointer Running check:construction without flags causes nil pointer dereference Jan 19, 2022
t-hale added a commit to t-hale/rosetta-cli that referenced this issue Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant