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

R4R: Multisig support #3264

Merged
merged 2 commits into from
Jan 16, 2019
Merged

R4R: Multisig support #3264

merged 2 commits into from
Jan 16, 2019

Conversation

alessio
Copy link
Contributor

@alessio alessio commented Jan 9, 2019

Habemus multisig:

  • New keys add --multisig flag to store multisig keys locally.
  • New multisign command to generate multisig signatures.
  • New sign --multisig flag to enable multisig mode.
  • Add multisig transactions support in ante handler
  • gaiad add-genesis-account can now take both account addresses and key names

Closes: #3198

  • 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)

@codecov
Copy link

codecov bot commented Jan 9, 2019

Codecov Report

Merging #3264 into develop will decrease coverage by 0.12%.
The diff coverage is 24.13%.

@@             Coverage Diff             @@
##           develop    #3264      +/-   ##
===========================================
- Coverage    55.64%   55.52%   -0.13%     
===========================================
  Files          134      134              
  Lines         9746     9764      +18     
===========================================
- Hits          5423     5421       -2     
- Misses        3980     3999      +19     
- Partials       343      344       +1

@alessio alessio force-pushed the alessio/multisig-workflow branch from 15ec441 to 7d50367 Compare January 10, 2019 01:11
@alessio
Copy link
Contributor Author

alessio commented Jan 10, 2019

Blocked on tendermint/tendermint#3101

@alessio alessio added the S:blocked Status: Blocked label Jan 10, 2019
@zmanian
Copy link
Member

zmanian commented Jan 10, 2019

I would recommend we use magic-wormhole https://github.com/warner/magic-wormhole in documentation to move partially signed transactions around.

@alessio alessio added S:blocked Status: Blocked and removed S:blocked Status: Blocked labels Jan 11, 2019
@alessio
Copy link
Contributor Author

alessio commented Jan 11, 2019

Blocked on #3279

@alessio alessio removed the S:blocked Status: Blocked label Jan 12, 2019
@alessio alessio changed the title WIP: Alessio/multisig workflow WIP: Multisig workflow Jan 12, 2019
@alessio alessio force-pushed the alessio/multisig-workflow branch 2 times, most recently from ff43ede to b498016 Compare January 15, 2019 00:10
@alessio alessio requested a review from zramsay as a code owner January 15, 2019 02:38
@alessio alessio force-pushed the alessio/multisig-workflow branch from 1ba51e3 to 99f11c0 Compare January 15, 2019 05:14
@alessio alessio changed the title WIP: Multisig workflow R4R: Multisig workflow Jan 15, 2019
@alessio alessio requested a review from zmanian January 15, 2019 05:17
@alessio alessio changed the title R4R: Multisig workflow R4R: Multisig support Jan 15, 2019
x/auth/ante.go Outdated Show resolved Hide resolved
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

Workflow looks reasonable to me, several comments.

client/keys/add.go Show resolved Hide resolved
@@ -28,7 +29,15 @@ func AddGenesisAccountCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command

addr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
kb, err := keys.GetKeyBaseFromDir(viper.GetString(flagClientHome))
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, this is convenient - I wonder if we should just support named aliases, but that can be a later question...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'm doing it just for convenience. But I wouldn't frown upon a change request and I reckon this could we be seen as superfluous.

docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
gaiacli keys add --multisig=baz,foo,bar --multisig-threshold=2 multisigaddress
```

Although keys and threshold parameter used in the above examples are the same, the commands
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we sort the names? This behaviour seems unusual, unless there's a specific reason we want it.

Copy link
Contributor

Choose a reason for hiding this comment

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

... actually, can we sort by the public keys? that way different names on different machines will still work

Copy link
Member

Choose a reason for hiding this comment

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

This sounds like a good idea. Ideally order doesn't matter here.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I second this. I can see simple mishaps happening due to this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorted - sorry for the pun.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've also added the flag --nosort so that a user can pass the keys in the exact order he wants and expect they don't get shuffled.

docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
x/auth/ante.go Outdated Show resolved Hide resolved
x/auth/client/cli/multisign.go Outdated Show resolved Hide resolved
x/auth/client/cli/multisign.go Show resolved Hide resolved
client/keys/add.go Outdated Show resolved Hide resolved
docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
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.

A couple of small comments 👆 but otherwise this is 💯 🎉 and should be merged.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Looks good @alessio -- I left some feedback.

client/keys/add.go Outdated Show resolved Hide resolved
client/keys/add.go Outdated Show resolved Hide resolved
client/utils/utils.go Outdated Show resolved Hide resolved
gaiacli keys add --multisig=baz,foo,bar --multisig-threshold=2 multisigaddress
```

Although keys and threshold parameter used in the above examples are the same, the commands
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I second this. I can see simple mishaps happening due to this.

docs/gaia/gaiacli.md Show resolved Hide resolved
x/auth/client/cli/multisign.go Show resolved Hide resolved
x/auth/client/cli/multisign.go Outdated Show resolved Hide resolved
@jackzampolin
Copy link
Member

A couple of test failures here @alessio

docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
@alexanderbez
Copy link
Contributor

Few more comments @alessio, also integration_tests is failing.

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

👍 👍 minor comments. Also we'll need to support multisig through gaia lite (maybe other PR)

client/keys/add.go Outdated Show resolved Hide resolved
cmd/gaia/cli_test/cli_test.go Outdated Show resolved Hide resolved
cmd/gaia/cli_test/cli_test.go Outdated Show resolved Hide resolved
cmd/gaia/cli_test/cli_test.go Outdated Show resolved Hide resolved
cmd/gaia/cli_test/cli_test.go Outdated Show resolved Hide resolved
docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
docs/gaia/gaiacli.md Outdated Show resolved Hide resolved
x/auth/client/cli/sign.go Outdated Show resolved Hide resolved
@alessio alessio force-pushed the alessio/multisig-workflow branch 5 times, most recently from e6c44da to 1b94623 Compare January 16, 2019 00:59

// Handle --nosort
if !viper.GetBool(flagNoSort) {
sort.Strings(multisigKeys)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should instead sort by the keys - that way different aliases on different computers will still result in the same public key.

Copy link
Contributor

Choose a reason for hiding this comment

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

I second this.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Looks good @alessio -- thoughts on sorting by pubkey as @cwgoes suggested?

PENDING.md Show resolved Hide resolved

// Handle --nosort
if !viper.GetBool(flagNoSort) {
sort.Strings(multisigKeys)
Copy link
Contributor

Choose a reason for hiding this comment

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

I second this.

Alessio Treglia added 2 commits January 16, 2019 15:38
- New keys add --multisig flag to store multisig keys
  locally.
- New multisign command to generate multisig
  signatures.
- New sign --multisig flag to enable multisig mode.
- Add multisig transactions support in ante handler.
- gaiad add-genesis-account can now take both account
  addresses and key names.

Closes: #3198
@alessio alessio force-pushed the alessio/multisig-workflow branch from 1b94623 to 0022513 Compare January 16, 2019 15:38
@jackzampolin jackzampolin merged commit 26cb0a1 into develop Jan 16, 2019
@jackzampolin jackzampolin deleted the alessio/multisig-workflow branch January 16, 2019 17:31
@alessio alessio mentioned this pull request Mar 16, 2020
4 tasks
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

Successfully merging this pull request may close these issues.

6 participants