-
Notifications
You must be signed in to change notification settings - Fork 871
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
Improve the selection of the most profitable built block #7174
Merged
fab-10
merged 7 commits into
hyperledger:main
from
fab-10:select-most-profitable-proposal
Jun 7, 2024
Merged
Improve the selection of the most profitable built block #7174
fab-10
merged 7 commits into
hyperledger:main
from
fab-10:select-most-profitable-proposal
Jun 7, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fab-10
force-pushed
the
select-most-profitable-proposal
branch
3 times, most recently
from
June 5, 2024 10:29
7efd4c8
to
d24a505
Compare
Signed-off-by: Fabio Di Fabio <[email protected]>
fab-10
force-pushed
the
select-most-profitable-proposal
branch
from
June 5, 2024 10:29
d24a505
to
c19f3c2
Compare
Signed-off-by: Fabio Di Fabio <[email protected]>
jflo
approved these changes
Jun 7, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but will need to adopt suggested change to fix javadocs.
consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/PayloadWrapper.java
Show resolved
Hide resolved
…erge/PayloadWrapper.java Co-authored-by: Justin Florentine <[email protected]> Signed-off-by: Fabio Di Fabio <[email protected]>
Signed-off-by: Fabio Di Fabio <[email protected]>
gtebrean
pushed a commit
to gtebrean/besu
that referenced
this pull request
Jun 26, 2024
…#7174) * Improve the selection of the most profitable built block Signed-off-by: Fabio Di Fabio <[email protected]> * Update CHANGELOG Signed-off-by: Fabio Di Fabio <[email protected]> * Update consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/PayloadWrapper.java Co-authored-by: Justin Florentine <[email protected]> Signed-off-by: Fabio Di Fabio <[email protected]> --------- Signed-off-by: Fabio Di Fabio <[email protected]> Co-authored-by: Justin Florentine <[email protected]> Signed-off-by: George Tebrean <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR description
when in PoS networks, Besu repeatedly builds proposal until the getPayload method is called, in order to try to include new txs that could arrive in the meantime, so when more that one block is created in the interval, we need to have a strategy to select the best one, currently the decision is simply made on the gas used of the block, since we include txs from the most profitable to the least.
So in theory the more the block is filled the more value it should have, but it turns out that there are edge cases where this assumption fails, in particular when the are enough txs to fill the block since the beginning, and following blocks are just a little smaller that the previous in term of gas, they are discarded even if better in term of value.
Real world example:
cumulativeGasUsed=29988510
and 50 txscumulativeGasUsed=29984151
and 185 txs with higher value, but since smaller by ~4000 gas is not selected as best.Calculating the block value, does not add computation time to getPayload, since it was already done to include it in the response, and was refactored to compute it only one and use everywhere it is needed.
Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests