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

Can't query multisig account #6745

Closed
4 tasks
yun-yeo opened this issue Jul 16, 2020 · 6 comments
Closed
4 tasks

Can't query multisig account #6745

yun-yeo opened this issue Jul 16, 2020 · 6 comments

Comments

@yun-yeo
Copy link
Contributor

yun-yeo commented Jul 16, 2020

Summary of Bug

Current account querier return MarshalJSON(Account) when it receive account query. A cli program, which request the account info, do UnmarshalJSON like Here. In this process, the cli program return error because multisig pubkey is longer than the length what bech32 decoder allow.

so the response is ERROR: decoding bech32 failed: invalid bech32 string length 217

ref) bech.Decode func

// Decode decodes a bech32 encoded string, returning the human-readable
// part and the data part excluding the checksum.
func Decode(bech string) (string, []byte, error) {
	// The maximum allowed length for a bech32 string is 90. It must also
	// be at least 8 characters, since it needs a non-empty HRP, a
	// separator, and a 6 character checksum.
	if len(bech) < 8 || len(bech) > 90 {
		return "", nil, fmt.Errorf("invalid bech32 string length %d",
			len(bech))
	}
...

Version

v0.38.x

Steps to Reproduce

  1. Create multisig address by send some amount of funds
  2. Send tx from the multisig address.
  3. Query multisig address

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@yun-yeo
Copy link
Contributor Author

yun-yeo commented Jul 16, 2020

Seems this is due to

pks, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, acc.PubKey)

I don't know why we need pretty function at custom MarshalJSON(). The actual Account is response returned from String() which is calling MarshalYAML().

@yun-yeo yun-yeo changed the title Can't query multisig account Can't query multisig account Jul 16, 2020
@yun-yeo yun-yeo mentioned this issue Jul 16, 2020
4 tasks
@webmaster128
Copy link
Member

It is not a problem of the decoder. The bech32 spec has a hard length limit of 90 characters. I.e. such long data should never be stored as bech32 in the first place.

@alexanderbez
Copy link
Contributor

alexanderbez commented Jul 16, 2020

@YunSuk-Yeo custom JSON Marshaling does not exist for the BaseAccount anymore (i.e. on master). If anything, we need to backport this to 0.38/0.39, but it's technically a breaking API change.

@alexanderbez
Copy link
Contributor

I'm going to close this issue and defer to @alessio on how to treat 0.38/0.39.

@alexanderbez
Copy link
Contributor

Fix on 0.39: #6749

@yun-yeo
Copy link
Contributor Author

yun-yeo commented Jul 17, 2020

Thanks for launch pad update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants