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: Implement generate-only option for commands that create txs #2165

Merged
merged 4 commits into from
Sep 4, 2018

Conversation

alessio
Copy link
Contributor

@alessio alessio commented Aug 27, 2018

The new CLI --generate-only flag builds an unsigned transaction and writes it to STDOUT. Likewise, REST clients can now append generate_only=true to a request's query arguments list and expect a JSON response carrying the unsigned transaction.

Closes: #966

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

@alessio alessio added the wip label Aug 27, 2018
@alessio alessio changed the title Alessio/966 tx generate only WIP: Alessio/966 tx generate only Aug 27, 2018
@codecov
Copy link

codecov bot commented Aug 28, 2018

Codecov Report

Merging #2165 into develop will decrease coverage by 0.27%.
The diff coverage is 5.26%.

@@             Coverage Diff             @@
##           develop    #2165      +/-   ##
===========================================
- Coverage    64.23%   63.95%   -0.28%     
===========================================
  Files          140      140              
  Lines         8575     8612      +37     
===========================================
  Hits          5508     5508              
- Misses        2690     2727      +37     
  Partials       377      377

@alessio alessio force-pushed the alessio/966-tx-generate-only branch 3 times, most recently from f98d1d6 to 1144625 Compare August 28, 2018 17:40
@alessio alessio force-pushed the alessio/966-tx-generate-only branch 3 times, most recently from 025b9a7 to f9c63dc Compare August 31, 2018 15:01
@alessio alessio force-pushed the alessio/966-tx-generate-only branch from f9c63dc to bc2473e Compare September 2, 2018 19:38
@alessio alessio changed the title WIP: Alessio/966 tx generate only Implement generate-only option for commands that create txs Sep 2, 2018
@alessio alessio requested a review from jackzampolin September 2, 2018 19:39
@alessio alessio added prelaunch and removed wip labels Sep 2, 2018
@alessio alessio changed the title Implement generate-only option for commands that create txs R4R: Implement generate-only option for commands that create txs Sep 2, 2018
@alessio alessio force-pushed the alessio/966-tx-generate-only branch from bc2473e to 413938b Compare September 3, 2018 02:27
@alessio alessio requested a review from jaekwon September 3, 2018 03:15
@cwgoes
Copy link
Contributor

cwgoes commented Sep 3, 2018

I think this is a bit redundant with "offline" (pubkey-only) keys in gaiacli - did you look at that code?

This is definitely something we want regardless - maybe offline keys should automatically trigger --generate-only?

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.

A bit of repeated code, also see comment re: offline keys.

x/gov/client/cli/tx.go Outdated Show resolved Hide resolved
x/bank/client/rest/sendtx.go Show resolved Hide resolved
The new CLI flag builds an unsigned transaction and writes it to STDOUT.
Likewise, REST clients can now append generate_only=true to a request's
query arguments list and expect a JSON response carrying the unsigned
transaction.

Closes: #966
@alessio alessio force-pushed the alessio/966-tx-generate-only branch from a74b9fa to 8639580 Compare September 4, 2018 00:32
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.

utACK. Just add the test that's missing to CLI to test the msg.Signature length

@alessio alessio force-pushed the alessio/966-tx-generate-only branch from bdbd556 to 8c32a8f Compare September 4, 2018 13:07
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.

tested ACK. Left a minor note on the pending log.

Also, during testing, I found that I can generate txs without an amount. Is this desired/expected behavior? I would assume this logic should be identical to actually generating a real tx (except without signing and sending)...in other words, it should go through the same validation checks. No?

PENDING.md Show resolved Hide resolved
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.

tested ACK. Thanks!

x/gov/client/cli/tx.go Show resolved Hide resolved
@jackzampolin
Copy link
Member

I don't know if we need validation on transaction generation. I think users should be able to generate w/o all required data and then fill in manually if desired. cc @alexanderbez Anyone else have thoughts here?

@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 4, 2018

@jackzampolin it provides more consistent behavior, but I poised it as a question more or less and not something that is necessary. I could be swayed the other way.

In other words, when I see --generate-only, my immediate thought is, "This does the exact same thing as without generate-only except signing and broadcasting". Hence my initial question 😄

@alessio
Copy link
Contributor Author

alessio commented Sep 4, 2018

Seems like we're all set and ready then

@alessio
Copy link
Contributor Author

alessio commented Sep 4, 2018

PR on sign command too is almost ready

@alessio
Copy link
Contributor Author

alessio commented Sep 4, 2018

@cwgoes are you happy with the changes?

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.

utACK, thanks @alessio

@cwgoes cwgoes merged commit a612068 into develop Sep 4, 2018
@cwgoes cwgoes deleted the alessio/966-tx-generate-only branch September 4, 2018 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants