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: Account numbers and sequences to uint64 #2799

Merged
merged 5 commits into from
Nov 26, 2018

Conversation

sunnya97
Copy link
Member

closes #2701

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

@codecov
Copy link

codecov bot commented Nov 13, 2018

Codecov Report

Merging #2799 into develop will not change coverage.
The diff coverage is 65.21%.

@@           Coverage Diff            @@
##           develop    #2799   +/-   ##
========================================
  Coverage    56.84%   56.84%           
========================================
  Files          120      120           
  Lines         8298     8298           
========================================
  Hits          4717     4717           
  Misses        3263     3263           
  Partials       318      318

@sunnya97 sunnya97 force-pushed the sunny/unsigned-accnum-sequence branch from 5914a77 to 76c5458 Compare November 15, 2018 01:01
@sunnya97 sunnya97 changed the title WIP: Account numbers and sequences to uint64 R4R: Account numbers and sequences to uint64 Nov 15, 2018
@sunnya97 sunnya97 requested a review from jaekwon November 15, 2018 01:02
@sunnya97 sunnya97 added ready-for-review T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). labels Nov 15, 2018
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.

File changes look OK. Is there anywhere we need to check for uint64 overflow / wraparound (anywhere account number and sequence aren't just monotonically increasing)?

@sunnya97
Copy link
Member Author

sunnya97 commented Nov 16, 2018

It should only ever be monotonically increasing.

Technically, even if we implement this: #1217
we still don't need to check for overflow. Doesn't matter that it overflows, as long as its increasing by 1 each time, and so it has 2^64 unique values before it wraps around 🤷‍♂️

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.

Tested ACK. Two minor CLI concerns, optional to fix.

@@ -38,10 +38,10 @@ func NewTxBuilderFromCLI() TxBuilder {

return TxBuilder{
ChainID: chainID,
AccountNumber: viper.GetInt64(client.FlagAccountNumber),
AccountNumber: uint64(viper.GetInt64(client.FlagAccountNumber)),
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be confusing if the user enters a negative number, maybe we should sanity check the input

Gas: client.GasFlagVar.Gas,
GasAdjustment: viper.GetFloat64(client.FlagGasAdjustment),
Sequence: viper.GetInt64(client.FlagSequence),
Sequence: uint64(viper.GetInt64(client.FlagSequence)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

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.

Changes LGTM -- I would just suggest updating PostCommands to add these two flags as uints:

	c.Flags().Uint64(FlagAccountNumber, 0, "AccountNumber number to sign the tx")
	c.Flags().Uint64(FlagSequence, 0, "Sequence number to sign the tx")

This way, I don't think we need to sanity check as @cwgoes suggested.

@rigelrozanski
Copy link
Contributor

many merge conflicts here!

@cwgoes cwgoes dismissed alexanderbez’s stale review November 26, 2018 11:29

Comments addressed.

@cwgoes cwgoes merged commit b7da2ea into develop Nov 26, 2018
@cwgoes cwgoes deleted the sunny/unsigned-accnum-sequence branch November 26, 2018 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch Auth AccountNumbers and SequenceNumbers to be uint64
5 participants