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

Add nonce to transaction #246

Merged
merged 4 commits into from May 22, 2019

Conversation

Projects
None yet
3 participants
@earlbread
Copy link
Member

commented May 20, 2019

This patch adds the nonce to Transaction<T> to prevent replaying transaction. #125

  • Added Transaction<T>.Nonce and RawTransaction.Nonce.
  • Added IStore.GetTxNonce method.
  • Added IStore.IncreaseTxNonce<T> method.
  • Added IStore.ForkTxNonce<T> method.
  • BlockChain<T>.Append() method became to throw InvalidTxNonceException when the Transaction<T>.Nonce is different from BlockChain<T>.GetNonce result of the Transaction<T>.Signer.

@earlbread earlbread self-assigned this May 20, 2019

@earlbread earlbread force-pushed the earlbread:transaction-nonce2 branch from 9017153 to 51174f5 May 20, 2019

@codecov

This comment has been minimized.

Copy link

commented May 20, 2019

Codecov Report

Merging #246 into master will increase coverage by 0.15%.
The diff coverage is 93.8%.

@@            Coverage Diff             @@
##           master     #246      +/-   ##
==========================================
+ Coverage   87.12%   87.28%   +0.15%     
==========================================
  Files         179      180       +1     
  Lines       11126    11394     +268     
==========================================
+ Hits         9694     9945     +251     
- Misses       1191     1206      +15     
- Partials      241      243       +2
Impacted Files Coverage Δ
Libplanet/Store/BaseStore.cs 100% <ø> (ø) ⬆️
Libplanet.Tests/Net/SwarmTest.cs 93.38% <100%> (+0.02%) ⬆️
Libplanet/Tx/Transaction.cs 94.61% <100%> (+0.2%) ⬆️
Libplanet.Tests/Blocks/BlockTest.cs 98.03% <100%> (+0.04%) ⬆️
Libplanet.Tests/Tx/TxFixture.cs 100% <100%> (ø) ⬆️
Libplanet/Blockchain/BlockChain.cs 96.25% <100%> (+0.27%) ⬆️
Libplanet.Tests/Store/FileStoreFixture.cs 89.89% <50%> (-0.92%) ⬇️
Libplanet.Tests/Store/StoreTracker.cs 50.42% <61.53%> (+1.38%) ⬆️
Libplanet/Tx/InvalidTxNonceException.cs 81.81% <81.81%> (ø)
Libplanet/Tx/RawTransaction.cs 82.5% <87.5%> (+10.96%) ⬆️
... and 6 more

@earlbread earlbread force-pushed the earlbread:transaction-nonce2 branch 2 times, most recently from 68470b9 to e9e4335 May 20, 2019

@earlbread earlbread force-pushed the earlbread:transaction-nonce2 branch 3 times, most recently from 615b797 to 0ec7fd4 May 21, 2019

@earlbread earlbread force-pushed the earlbread:transaction-nonce2 branch from 0ec7fd4 to b11d0a2 May 21, 2019

@earlbread earlbread requested review from dahlia and longfin and removed request for dahlia May 21, 2019

@earlbread earlbread marked this pull request as ready for review May 21, 2019

Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved Libplanet.Tests/Blockchain/BlockChainTest.cs Outdated
Show resolved Hide resolved Libplanet/Store/IStore.cs Outdated
Show resolved Hide resolved Libplanet/Tx/Transaction.cs Outdated
Show resolved Hide resolved Libplanet/Tx/Transaction.cs Outdated
Show resolved Hide resolved Libplanet/Tx/InvalidTxNonceException.cs Outdated
Show resolved Hide resolved Libplanet/Tx/InvalidTxNonceException.cs Outdated
Show resolved Hide resolved Libplanet/Tx/InvalidTxNonceException.cs Outdated
Show resolved Hide resolved Libplanet/Store/FileStore.cs Outdated

@earlbread earlbread force-pushed the earlbread:transaction-nonce2 branch from 5f4e21e to 506b609 May 22, 2019

@dahlia

dahlia approved these changes May 22, 2019

@earlbread earlbread merged commit 282651f into planetarium:master May 22, 2019

15 checks passed

Travis CI - Pull Request Build Passed
Details
WIP Ready for review
Details
changelog This contains self-describing changelog.
Details
codecov/patch 93.8% of diff hit (target 87.12%)
Details
codecov/project 87.28% (+0.15%) compared to 5fe21e7
Details
docs Libplanet docs generated by DocFX
Details
planetarium.libplanet Build #20190522.1 succeeded
Details
planetarium.libplanet (Linux_Mono) Linux_Mono succeeded
Details
planetarium.libplanet (Linux_NETCore) Linux_NETCore succeeded
Details
planetarium.libplanet (Windows_Mono) Windows_Mono succeeded
Details
planetarium.libplanet (Windows_NETCore) Windows_NETCore succeeded
Details
planetarium.libplanet (Windows_NETCore_coverage) Windows_NETCore_coverage succeeded
Details
planetarium.libplanet (Windows_NETFramework) Windows_NETFramework succeeded
Details
planetarium.libplanet (macOS_Mono) macOS_Mono succeeded
Details
planetarium.libplanet (macOS_NETCore) macOS_NETCore succeeded
Details

@earlbread earlbread deleted the earlbread:transaction-nonce2 branch May 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.