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

Made BlockChain<T>.GetNonce() to refer staged transactions #270

Merged

Conversation

longfin
Copy link
Member

@longfin longfin commented Jun 3, 2019

This PR adds includeStage to BlockChain<T>.GetNonce() to refer staged transactions during nonce computation.

I've changed BlockChain<T>.GetNonce() to refer staged transactions without any other options.

@longfin longfin force-pushed the feature/get-nonce-include-staging branch from 7765313 to ed25fa0 Compare June 3, 2019 14:02
@longfin longfin marked this pull request as ready for review June 3, 2019 14:06
@codecov
Copy link

codecov bot commented Jun 3, 2019

Codecov Report

Merging #270 into master will increase coverage by 0.05%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #270      +/-   ##
==========================================
+ Coverage   86.96%   87.01%   +0.05%     
==========================================
  Files         180      180              
  Lines       11389    11432      +43     
==========================================
+ Hits         9904     9948      +44     
  Misses       1241     1241              
+ Partials      244      243       -1
Impacted Files Coverage Δ
Libplanet.Tests/Blockchain/BlockChainTest.cs 98.95% <100%> (+0.04%) ⬆️
Libplanet/Blockchain/BlockChain.cs 96.42% <100%> (+0.13%) ⬆️
Libplanet/Crypto/PrivateKey.cs 85.58% <0%> (+0.9%) ⬆️

@codecov-io
Copy link

codecov-io commented Jun 3, 2019

Codecov Report

Merging #270 into master will increase coverage by 0.15%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #270      +/-   ##
==========================================
+ Coverage   86.96%   87.11%   +0.15%     
==========================================
  Files         180      180              
  Lines       11389    11444      +55     
==========================================
+ Hits         9904     9970      +66     
+ Misses       1241     1231      -10     
+ Partials      244      243       -1
Impacted Files Coverage Δ
Libplanet.Tests/Blockchain/BlockChainTest.cs 98.96% <100%> (+0.05%) ⬆️
Libplanet/Blockchain/BlockChain.cs 96.47% <100%> (+0.18%) ⬆️
Libplanet/Net/Swarm.cs 75.76% <0%> (+0.8%) ⬆️
Libplanet/Crypto/PrivateKey.cs 85.58% <0%> (+0.9%) ⬆️

@longfin longfin force-pushed the feature/get-nonce-include-staging branch from ed25fa0 to 0b89584 Compare June 4, 2019 04:42
@longfin longfin force-pushed the feature/get-nonce-include-staging branch from 0b89584 to 007856b Compare June 4, 2019 04:42
@longfin
Copy link
Member Author

longfin commented Jun 4, 2019

I've added two changes.

  • Fixed bug that nonce validation ignores previous nonce.
  • Fixed to arrange the tx of the block to be mined in order of nonce.

@longfin longfin requested review from earlbread and dahlia June 4, 2019 04:48
earlbread
earlbread previously approved these changes Jun 4, 2019
@longfin longfin changed the title Add includeStage to BlockChain<T>.GetNonce() Made BlockChain<T>.GetNonce() to refer staged transactions Jun 4, 2019
@longfin
Copy link
Member Author

longfin commented Jun 4, 2019

I've changed BlockChain.GetNonce() to refer staged transactions without any other options.

earlbread
earlbread previously approved these changes Jun 4, 2019
@dahlia
Copy link
Contributor

dahlia commented Jun 4, 2019

I've changed BlockChain.GetNonce() to refer staged transactions without any other options.

Could you let me know why did you removed that option?

@longfin
Copy link
Member Author

longfin commented Jun 4, 2019

I've changed BlockChain.GetNonce() to refer staged transactions without any other options.

Could you let me know why did you removed that option?

  • It seemed that we would not have to keep the existing behavior without referencing the staged transactions
    • I did not come up with a scenario that required old behavior enough to provide the option separately
  • Also, I wanted to minimize the options that users could make mistakes

Copy link
Contributor

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Also, I wanted to minimize the options that users could make mistakes

Pair enough. In this perspective, we should eventually get rid of this method at all and make users able to make transactions without knowing the concept of tx nonce.

CHANGES.md Outdated Show resolved Hide resolved
Co-Authored-By: Hong Minhee <hong.minhee@gmail.com>
dahlia
dahlia approved these changes Jun 4, 2019
@longfin longfin merged commit 36f7206 into planetarium:master Jun 4, 2019
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.

4 participants