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

Fix BlockChain<T>.Append() to disallow block with too many txs #1104

Merged
merged 1 commit into from
Nov 25, 2020

Conversation

dahlia
Copy link
Contributor

@dahlia dahlia commented Nov 25, 2020

In the commit 1d35777, we added IBlockPolicy<T>.MaxTransactionsPerBlock property, but it had only functioned as a default value for BlockChain<T>.MineBlock() method's maxTransactions option. This had misled and been unintended, because BlockChain<T>.Append() still had accept blocks violating its policy (Block<T> having more Transactions than the number a policy allows still can be made with Block<T>.Mine() method).

Although this adds BlockExceedingTransactionsException class, since it would be released as a patch release, it's not public yet. We should make it public when it's ported to the upstream main (next major/minor release).

In the commit 1d35777, we added
IBlockPolicy<T>.MaxTransactionsPerBlock property, but it had only
functioned as a default value for BlockChain<T>.MineBlock() method's
maxTransactions option.  This had misled and been unintended,
because BlockChain<T>.Append() still had accept blocks violating
its policy (Block<T> having more Transactions than the number a policy
allows still can be made with Block<T>.Mine() method).

Although this adds BlockExceedingTransactionsException class,
since it would be released as a patch release, it's not public yet.
We should make it public when it's ported to the upstream main (next
major/minor release).
@dahlia dahlia added the bug Something isn't working label Nov 25, 2020
@dahlia dahlia self-assigned this Nov 25, 2020
@auto-assign auto-assign bot requested a review from earlbread November 25, 2020 07:45
@codecov
Copy link

codecov bot commented Nov 25, 2020

Codecov Report

Merging #1104 (a43d893) into 0.10-maintenance (36d4794) will decrease coverage by 0.05%.
The diff coverage is 64.78%.

@@                 Coverage Diff                  @@
##           0.10-maintenance    #1104      +/-   ##
====================================================
- Coverage             88.33%   88.27%   -0.06%     
====================================================
  Files                   345      347       +2     
  Lines                 31917    31986      +69     
====================================================
+ Hits                  28194    28236      +42     
- Misses                 2041     2062      +21     
- Partials               1682     1688       +6     
Impacted Files Coverage Δ
.../Blocks/BlockExceedingTransactionsExceptionTest.cs 0.00% <0.00%> (ø)
...anet/Blocks/BlockExceedingTransactionsException.cs 47.61% <47.61%> (ø)
Libplanet.Tests/Blockchain/BlockChainTest.cs 98.59% <96.29%> (-0.03%) ⬇️
Libplanet/Blockchain/BlockChain.cs 90.77% <100.00%> (+0.06%) ⬆️
...bplanet/Blocks/InvalidBlockBytesLengthException.cs 47.61% <100.00%> (ø)
Libplanet.Stun/Stun/TurnClient.cs 77.82% <0.00%> (-1.26%) ⬇️
Libplanet/Net/BlockCompletion.cs 94.18% <0.00%> (-0.88%) ⬇️
Libplanet/Net/Swarm.cs 83.97% <0.00%> (-0.44%) ⬇️
Libplanet/Net/NetMQTransport.cs 81.66% <0.00%> (-0.25%) ⬇️
... and 4 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants