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: reading pubkey from ledger panic #350

Merged
merged 3 commits into from
Jun 5, 2023

Conversation

j75689
Copy link
Collaborator

@j75689 j75689 commented Jun 5, 2023

Description

./build/bnbcli keys add validator --ledger    
panic: length of pubkey is incorrect,length: 0, pubKey: PubKeySecp256k1{}

goroutine 1 [running]:
github.com/tendermint/tendermint/crypto/secp256k1.PubKeySecp256k1.Address({0x0, 0x0, 0x0})
        /Users/dylan.huang/go/pkg/mod/github.com/bnb-chain/bnc-tendermint@v0.32.3-bc.10/crypto/secp256k1/secp256k1.go:197 +0x184
github.com/cosmos/cosmos-sdk/crypto/keys.ledgerInfo.GetAddress(...)
        /Users/dylan.huang/go/pkg/mod/github.com/bnb-chain/bnc-cosmos-sdk@v0.26.4/crypto/keys/types.go:154
github.com/cosmos/cosmos-sdk/crypto/keys.dbKeybase.writeInfo({{0x103dd45a8?, 0x14000010858?}}, {0x103dcdbc0, 0x140002ec040}, {0x16ce5b408?, 0x1400032c108?})
        /Users/dylan.huang/go/pkg/mod/github.com/bnb-chain/bnc-cosmos-sdk@v0.26.4/crypto/keys/keybase.go:474 +0xf0
github.com/cosmos/cosmos-sdk/crypto/keys.dbKeybase.writeLedgerKey({{0x103dd45a8?, 0x14000010858?}}, {0x103dcec60?, 0x104456780}, {0x1400032c108, 0x5, 0x5}, {0x16ce5b408, 0x9})
        /Users/dylan.huang/go/pkg/mod/github.com/bnb-chain/bnc-cosmos-sdk@v0.26.4/crypto/keys/keybase.go:459 +0xfc
github.com/cosmos/cosmos-sdk/crypto/keys.dbKeybase.CreateLedger({{0x103dd45a8?, 0x14000010858?}}, {0x16ce5b408, 0x9}, {0x1400032c108, 0x5, 0x5}, {0x10386124d?, 0x103c5cd01?})
        /Users/dylan.huang/go/pkg/mod/github.com/bnb-chain/bnc-cosmos-sdk@v0.26.4/crypto/keys/keybase.go:172 +0xf8
github.com/cosmos/cosmos-sdk/client/keys.runAddCmd(0x140002ebb80?, {0x1400038c1e0, 0x1, 0x2?})
        /Users/dylan.huang/go/pkg/mod/github.com/bnb-chain/bnc-cosmos-sdk@v0.26.4/client/keys/add.go:113 +0x41c
github.com/spf13/cobra.(*Command).execute(0x140002ebb80, {0x1400038c160, 0x2, 0x2})
        /Users/dylan.huang/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826 +0x4c4
github.com/spf13/cobra.(*Command).ExecuteC(0x104414c60)
        /Users/dylan.huang/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2a4
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/dylan.huang/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/tendermint/tendermint/libs/cli.Executor.Execute({0x104414c60?, 0x103dc12e8?})
        /Users/dylan.huang/go/pkg/mod/github.com/bnb-chain/bnc-tendermint@v0.32.3-bc.10/libs/cli/setup.go:89 +0x38
main.main()
        /Users/dylan.huang/git/node/cmd/bnbcli/main.go:104 +0x60c

Rationale

tmsecp256k1.PubKeySecp256k1 does not pre-allocate the length, resulting in no actual effect when copying bytes

@j75689 j75689 changed the title fix: reading pubkey from ledger error fix: reading pubkey from ledger panic Jun 5, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #350 (164d949) into master (259050b) will decrease coverage by 0.87%.
The diff coverage is 4.70%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #350      +/-   ##
==========================================
- Coverage   46.78%   45.91%   -0.87%     
==========================================
  Files         247      248       +1     
  Lines       23741    24212     +471     
==========================================
+ Hits        11107    11118      +11     
- Misses      11968    12428     +460     
  Partials      666      666              

@j75689 j75689 changed the base branch from master to develop June 5, 2023 10:28
@j75689 j75689 merged commit 8538f32 into bnb-chain:develop Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants