Cosmos-sdk: Cannot get pubKeys form multisig (Bech32KeyOutput)

Created on 14 May 2019  路  1Comment  路  Source: cosmos/cosmos-sdk

I can't get pubKeys from multisig by implement following to below.

  1. Create Info of Multisig:
    info := keys.NewMultiInfo(name, multikey)
    remark: I can do it. Prove it with fmt.Println
=== info ===
&{Wallet {1 [PubKeySecp256k1{033AF09F14E98A992519FF24B78E6C29F1A96B9CFBA127765F585605C748F061BE}]} 1 [{PubKeySecp256k1{033AF09F14E98A992519FF24B78E6C29F1A96B9CFBA127765F585605C748F061BE} 1}]}
  1. Import info to function of Cosmos-SDK
    ko, err := keys.Bech32KeyOutput(info)
    remark: I can do it. Prove it with fmt.Println
NAME:   TYPE:   ADDRESS:                    PUBKEY:
Wallet  multi   cosmos15s8j38qm62g0rm23u87tulvq2anhregf3zclzk   cosmospub1ytql0csgqyfzd666axrjzqe67z03f6v2nyj3nleyk78xc203494ee7apyam97kzkqhr53urphccg97s3
  1. After that, I get ko.PubKeys which it don't have data of owner account.
>>>>>>>>>>>> Bug Get PubKeys >>>>>>>>>>>>>>
ko.PubKeys []
WEIGHT: THRESHOLD:  ADDRESS:                    PUBKEY:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Below, I attach code.
Code:
Screen Shot 2562-05-14 at 18 14 30

Result:
Screen Shot 2562-05-14 at 18 14 04

bug good first issue keys

Most helpful comment

So the functionality to show multsig pubkey constitutions does actually work, example:

$ gaiacli keys show node012 --home ./build/node0/gaiacli --show-multisig
WEIGHT: THRESHOLD:  ADDRESS:                    PUBKEY:
1   2       cosmos19t5d8wx43rmtxgynxpyd7kf4qzrf9tg32fz3a0   cosmospub1addwnpepqwp7qtxppn9qkejcw3d0wfhlw2ekqpgesg3ccaftz7mryn286l5vca83rwn
1   2       cosmos1hsktdq8ftxj4dx5ndnpcee9rg6evd95xw0rp67   cosmospub1addwnpepqvkestj22um5hjudwflz57gmta7nvq95nvy7dxyy3qu0wf730f0p62dmt00
1   2       cosmos1m9547m99vs8e9f40acs7tveg7zuxzrhhcpezc6   cosmospub1addwnpepq2gqyg3t9yn00ew60l5qugsfvcsmcy8rf9cwqa0cpat7yn2cfmspqx4g99l

However, the code example you pasted indeed does not work and does seem like a bug. The reason is because NewMultiInfo returns a _pointer_ (like all info objects). However, Bech32KeyOutput does a type check on a non-pointer. This seems like a bug.

https://github.com/cosmos/cosmos-sdk/blob/9a16e2675f392b083dd1074ff92ff1f9fbda750d/crypto/keys/output.go#L92

This should be: if mInfo, ok := info.(*multiInfo); ok {

/cc @alessio

>All comments

So the functionality to show multsig pubkey constitutions does actually work, example:

$ gaiacli keys show node012 --home ./build/node0/gaiacli --show-multisig
WEIGHT: THRESHOLD:  ADDRESS:                    PUBKEY:
1   2       cosmos19t5d8wx43rmtxgynxpyd7kf4qzrf9tg32fz3a0   cosmospub1addwnpepqwp7qtxppn9qkejcw3d0wfhlw2ekqpgesg3ccaftz7mryn286l5vca83rwn
1   2       cosmos1hsktdq8ftxj4dx5ndnpcee9rg6evd95xw0rp67   cosmospub1addwnpepqvkestj22um5hjudwflz57gmta7nvq95nvy7dxyy3qu0wf730f0p62dmt00
1   2       cosmos1m9547m99vs8e9f40acs7tveg7zuxzrhhcpezc6   cosmospub1addwnpepq2gqyg3t9yn00ew60l5qugsfvcsmcy8rf9cwqa0cpat7yn2cfmspqx4g99l

However, the code example you pasted indeed does not work and does seem like a bug. The reason is because NewMultiInfo returns a _pointer_ (like all info objects). However, Bech32KeyOutput does a type check on a non-pointer. This seems like a bug.

https://github.com/cosmos/cosmos-sdk/blob/9a16e2675f392b083dd1074ff92ff1f9fbda750d/crypto/keys/output.go#L92

This should be: if mInfo, ok := info.(*multiInfo); ok {

/cc @alessio

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cwgoes picture cwgoes  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

fedekunze picture fedekunze  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

fedekunze picture fedekunze  路  3Comments