Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Implement max message size rather than limiting with fixed number of transactions #1271

Conversation

AbdelStark
Copy link
Contributor

PR description

Adding transactions to the RLP until the message size exceeds the limit and then send that.

Fixed Issue(s)

fixes #PAN-1005

…actions

Adding transactions to the RLP until the message size exceeds the limit and then send that.
@AbdelStark AbdelStark added enhancement New feature or request performance Related to performance WIP work in progress labels Apr 12, 2019
@AbdelStark AbdelStark removed the WIP work in progress label Apr 12, 2019
AbdelStark and others added 4 commits April 12, 2019 18:04
put this factory method on LimitedTransactionsMessages rather than TransactionsMessage since it returns a LimitedTransactionsMessages.
allTxToSend.removeAll(subsetToSend);
final LimitedTransactionsMessages limitedTransactionsMessages =
LimitedTransactionsMessages.createLimited(allTxToSend);
allTxToSend.removeAll(limitedTransactionsMessages.getIncludedTransactions());
Copy link
Contributor

Choose a reason for hiding this comment

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

(optional) You could also have LimitedTransactionsMessages.createLimited return a stream of TransactionMessages, then you don't need the extra removeAll bookkeeping and the extra memory for the included tx's list.

mbaxter and others added 4 commits April 15, 2019 19:00
…messages/LimitedTransactionsMessages.java

Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>
Copy link
Contributor

@mbaxter mbaxter left a comment

Choose a reason for hiding this comment

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

Left a few more small comments that would be good to address.

assertEquals(781, secondMessage.getIncludedTransactions().size());
txs.removeAll(secondMessage.getIncludedTransactions());
assertEquals(0, txs.size());
assertTrue(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you cut this assertion? I think it just ends up being confusing.

@AbdelStark AbdelStark merged commit 7cf96ac into PegaSysEng:master Apr 17, 2019
notlesh pushed a commit to notlesh/pantheon that referenced this pull request Apr 24, 2019
…transactions (PegaSysEng#1271)

* Implement max message size rather then cap with fixed number of transactions

Adding transactions to the RLP until the message size exceeds the limit and then send that.

* fix final variables

* Update AbstractRLPOutput.java

add javadoc

* pr discussion

put this factory method on LimitedTransactionsMessages rather than TransactionsMessage since it returns a LimitedTransactionsMessages.

* SpotlessApply

* fix PR discussion

- simplify design
- remove useless code

* Update LimitedTransactionsMessages.java

* fix PR discussion

- simplify logic
- add tests

* Update AbstractRLPOutput.java

* Update ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/messages/LimitedTransactionsMessages.java

Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>

* Update Transaction.java

* fix PR discussion

* fix PR discussion

- add tests

* Update BlockDataGenerator.java

* Update LimitedTransactionsMessagesTest.java

fix PR unit test

* Update LimitedTransactionsMessagesTest.java

* Update LimitedTransactionsMessagesTest.java

Use LinkedHashSet to preserve order.

* Update LimitedTransactionsMessagesTest.java
notlesh pushed a commit to notlesh/pantheon that referenced this pull request May 4, 2019
…transactions (PegaSysEng#1271)

* Implement max message size rather then cap with fixed number of transactions

Adding transactions to the RLP until the message size exceeds the limit and then send that.

* fix final variables

* Update AbstractRLPOutput.java

add javadoc

* pr discussion

put this factory method on LimitedTransactionsMessages rather than TransactionsMessage since it returns a LimitedTransactionsMessages.

* SpotlessApply

* fix PR discussion

- simplify design
- remove useless code

* Update LimitedTransactionsMessages.java

* fix PR discussion

- simplify logic
- add tests

* Update AbstractRLPOutput.java

* Update ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/messages/LimitedTransactionsMessages.java

Co-Authored-By: abdelhamidbakhta <45264458+abdelhamidbakhta@users.noreply.github.com>

* Update Transaction.java

* fix PR discussion

* fix PR discussion

- add tests

* Update BlockDataGenerator.java

* Update LimitedTransactionsMessagesTest.java

fix PR unit test

* Update LimitedTransactionsMessagesTest.java

* Update LimitedTransactionsMessagesTest.java

Use LinkedHashSet to preserve order.

* Update LimitedTransactionsMessagesTest.java
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request performance Related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants