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

Policy contract's SetMaxTransactionsPerBlock() doesn't check for Block.MaxTransactionsPerBlock #1937

Closed
roman-khimov opened this issue Sep 15, 2020 · 0 comments · Fixed by #1938
Assignees

Comments

@roman-khimov
Copy link
Contributor

Describe the bug
Some policy values while being configurable are still limited by other hardcoded constraints, like SetMaxBlockSize() has to check the value passed against Network.P2P.Message.PayloadMaxSize, because it's not very useful to have blocks that couldn't be distributed via P2P.

SetMaxTransactionsPerBlock() at the moment allows any uint value to be set, but there are P2P limitations of MaxContentsPerBlock and MaxTransactionsPerBlock imposed by the Block class and setting policy value to some higher number would just create undeserializable block if anyone is to attempt to put this many transactions into it.

Expected behavior
SetMaxTransactionsPerBlock() should check the value passed against Block.MaxTransactionsPerBlock.

(Optional) Additional context
While we're here I'd also propose increasing Block.MaxTransactionsPerBlock two-fold. Given some typical 250-byte transactions a block with a length of Network.P2P.Message.PayloadMaxSize has enough space for just a little more than 128K of them.

Although even when the number of transactions per block is only limited by the payload size, some test results may look like this:

tpb_single_30_wrk_leveldb

Still, 64K is not allowing to use all of PayloadMaxSize capacity.

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 a pull request may close this issue.

2 participants