berachain / beacon-kit

A modular framework for building EVM consensus clients ⛵️✨
https://berachain.com
Other
170 stars 122 forks source link

beacond comet show-validator is broken #2123

Open chuck-bear opened 2 weeks ago

chuck-bear commented 2 weeks ago

beacond comet show-validator is broken since maybe alpha.5.

How to reproduce?

In the main branch, run:

make build
build/bin/beacond comet show-validator

Output:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x48 pc=0x10162a2a0]

goroutine 1 [running]:
github.com/berachain/beacon-kit/mod/consensus/pkg/cometbft/cli.ShowValidatorCmd.func1(0x14000c4db08, {0x101819d30?, 0x4?, 0x101819bfc?})
    github.com/berachain/beacon-kit/mod/consensus/pkg/cometbft/cli/commands.go:161 +0x170
github.com/spf13/cobra.(*Command).execute(0x14000c4db08, {0x1036e62a0, 0x0, 0x0})
    github.com/spf13/cobra@v1.8.1/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x14000c4d208)
    github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/spf13/cobra.(*Command).ExecuteContext(...)
    github.com/spf13/cobra@v1.8.1/command.go:1034
github.com/berachain/beacon-kit/mod/cli/pkg/commands/server/cmd.Execute(0x14000c4d208, {0x0, 0x0}, {0x14000292f60, 0x1d})
    github.com/berachain/beacon-kit/mod/cli/pkg/commands/server/cmd/execute.go:56 +0x244
github.com/berachain/beacon-kit/mod/cli/pkg/commands.(*Root).Run(0x14000c39080?, {0x14000292f60?, 0x18?})
    github.com/berachain/beacon-kit/mod/cli/pkg/commands/root.go:92 +0x34
main.run()
    github.com/berachain/beacon-kit/beacond/cmd/main.go:86 +0x334
main.main()
    github.com/berachain/beacon-kit/beacond/cmd/main.go:91 +0x1c

What should be the output here?

{"type":"cometbft/PubKeyBls12_381","value":"ghfsdgfjsdfgjasghjsfahgjsdfghj"}

This is basically the pub_key part in the priv_validator_key.json.

The bet-cli has an example of "fix".

abi87 commented 2 weeks ago

@chuck-bear thanks for filing the issue. I don't know what the bet-cli is. I don't have a solution yet, but I have been able to repro the issue and can provide some preliminary details. Crash is due to nil pointer exception. We are not specifying a codec for the command at hand. For context see difference among:

The missing bit is figuring out how to duly initialize the codec so that it can work with currently used types.

chuck-bear commented 2 weeks ago

bet-cli is a branch here

chuck-bear commented 2 weeks ago

https://github.com/berachain/beacon-kit/tree/bet-cli