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

Multisig Display UX Improvements #3748

Merged
merged 20 commits into from
Mar 1, 2019

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Feb 26, 2019

  • Move output types and functionality from client/keys to crypto/keys
  • Add new multiInfo type which includes constituent pubkeys and respective weights and threshold
  • Remove duplicate code
  • Update and cleanup gaiacli docs wrt to multisigs
  • Update gaiacli tx sign --validate-signatures to include multisig info

closes: #3738


You can view the composition of a multisig via two ways:

  1. gaiacli keys show multi1 -o json | prettyjson
{
    "name": "multi1",
    "type": "multi",
    "address": "cosmos1m4kcw5ns54jnxwuen0m6r4jf08km2kphksf393",
    "pubkey": "cosmospub1ytql0csgqgfzd666axrjzqn57z33n9cm2md9y477e05njsukmc4jl2ja4xyf85pf0mg8jtpxrufzd666axrjzqal2yzlnrux390dr9m0784e0vy0was084nsw8nzl8xkem8xjrj6jvfzd666axrjzql6qmmkde59y3tgdcq9ymk4cy3njn2gzaqmdftuzyrqr3xswcrrnyln9lzj",
    "threshold": "2",
    "pubkeys": [
        {
            "address": "cosmos1xa9gudtppp6zz27dvhl0v57ypcufcuq4guvavv",
            "pubkey": "cosmospub1addwnpepqf60pgcejud4dkjj2l0vh6fegwtdu2e04fw6nzyn6q5ha5re9snp7sumvka",
            "weight": "1"
        },
        {
            "address": "cosmos1dxuhzzf9xr977qexv79ze3yat6z6u34heea7x9",
            "pubkey": "cosmospub1addwnpepqwl4zp0e37rgjhk3jahlr6uhkz8hwc8n6ec8re30nntvannfpedfx87zzym",
            "weight": "1"
        },
        {
            "address": "cosmos1d057e8txsmhat75awtq73aq0x2enuazk77rk3r",
            "pubkey": "cosmospub1addwnpepq0aqdamxu6zjg45xuqzjdm2uzgeef4ypwsdk547pzpspcng8vp3ej6yzpwx",
            "weight": "1"
        }
    ]
}
  1. gaiacli keys show multi1 --show-multisig
WEIGHT:	THRESHOLD:	ADDRESS:					PUBKEY:
1	2		cosmos1xa9gudtppp6zz27dvhl0v57ypcufcuq4guvavv	cosmospub1addwnpepqf60pgcejud4dkjj2l0vh6fegwtdu2e04fw6nzyn6q5ha5re9snp7sumvka
1	2		cosmos1dxuhzzf9xr977qexv79ze3yat6z6u34heea7x9	cosmospub1addwnpepqwl4zp0e37rgjhk3jahlr6uhkz8hwc8n6ec8re30nntvannfpedfx87zzym
1	2		cosmos1d057e8txsmhat75awtq73aq0x2enuazk77rk3r	cosmospub1addwnpepq0aqdamxu6zjg45xuqzjdm2uzgeef4ypwsdk547pzpspcng8vp3ej6yzpwx

gaiacli tx sign --validate-signatures now displays the following for multisig-based txs:

Signers:
  0: cosmos1nmd7x2gktd2qxjunyj6wwuhqj9wej09490qche

Signatures:
  0: cosmos1nmd7x2gktd2qxjunyj6wwuhqj9wej09490qche			[ERROR: signature invalid] [multisig threshold: 2/3]
  MultiSig Signatures:
    1: cosmos18h79xwz9aw9f5yaffxq2gp2jglzr94u3thqy8c (weight: 1)


ERROR: signatures validation failed
Signers:
  0: cosmos1nmd7x2gktd2qxjunyj6wwuhqj9wej09490qche

Signatures:
  0: cosmos1nmd7x2gktd2qxjunyj6wwuhqj9wej09490qche			[OK] [multisig threshold: 2/3]
  MultiSig Signatures:
    0: cosmos1zureek89ppyzna4kvd26567rcukptzdf94qyzv (weight: 1)
    1: cosmos18h79xwz9aw9f5yaffxq2gp2jglzr94u3thqy8c (weight: 1)

/cc @zmanian


  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alexanderbez alexanderbez added WIP C:Keys Keybase, KMS and HSMs labels Feb 26, 2019
@codecov
Copy link

codecov bot commented Feb 26, 2019

Codecov Report

Merging #3748 into develop will decrease coverage by 0.4%.
The diff coverage is 19.23%.

@@             Coverage Diff             @@
##           develop    #3748      +/-   ##
===========================================
- Coverage     61.4%   60.99%   -0.41%     
===========================================
  Files          190      191       +1     
  Lines        14122    14174      +52     
===========================================
- Hits          8671     8645      -26     
- Misses        4894     4975      +81     
+ Partials       557      554       -3

client/keys/show.go Outdated Show resolved Hide resolved
@alexanderbez alexanderbez changed the title Multisig UX Improvements Multisig Display UX Improvements Feb 27, 2019
@alexanderbez alexanderbez marked this pull request as ready for review February 27, 2019 16:59
* [\#3738] Improve multisig UX:
* `gaiacli keys show -o json` now includes constituent pubkeys, respective weights and threshold
* `gaiacli keys show --show-multisig` now displays constituent pubkeys, respective weights and threshold
* `gaiacli tx sign --validate-signatures` now displays multisig signers with their respective weights
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪 ++

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-o json implies --show-multisig then, doesn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A user can either 1. -o json which will show multi-sig info OR 2. --show-multisig which will show multisig info in plaintext (non-JSON).

Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much improved here! Thank you @alexanderbez! LGTM 👍

@@ -14,10 +14,11 @@ import (

cmn "github.com/tendermint/tendermint/libs/common"

"github.com/cosmos/cosmos-sdk/client/keys"
clientkeys "github.com/cosmos/cosmos-sdk/client/keys"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember to have seen this import being aliased with clkeys somewhere else in the codebase. It'd be nice if we could stay consistent. Not a blocker though.

multiSigMsg = b.String()
}

fmt.Printf(" %d: %s\t\t\t[%s]%s%s\n", i, sigAddr.String(), sigSanity, multiSigHeader, multiSigMsg)
}

fmt.Println("")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't recally why we wanted to print an extra new line...

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nihil obstat

@jackzampolin jackzampolin merged commit 47a44fb into develop Mar 1, 2019
@jackzampolin jackzampolin deleted the bez/3738-multisig-ux-improvements branch March 1, 2019 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Keys Keybase, KMS and HSMs T: UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gaiacli keys show <multisig> should show constituent pubkeys, and weights
3 participants