-
Notifications
You must be signed in to change notification settings - Fork 264
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
feat: loop through all txs before returning the tx set to consensus #1113
Conversation
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.
LGTM! Do we want a test for the situation where the mempool has: [bigTx, smallTx]
where bigTx would exceed maxBytes?
I infer that before this PR neither would be reaped. After this PR the bigTx would be skipped and the smallTx would be reaped.
Yeah good idea. I'll add a test for that |
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.
👍
// smaller low priority tx with different sender | ||
smallTx := []byte(fmt.Sprintf("sender-2-1=%X=1", smallPrefix)) | ||
require.NoError(t, txmp.CheckTx(bigTx, nil, mempool.TxInfo{SenderID: 1})) | ||
require.NoError(t, txmp.CheckTx(smallTx, nil, mempool.TxInfo{SenderID: 1})) |
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.
I don't think it impacts the results of the test but is this line supposed to have a different SenderID?
require.NoError(t, txmp.CheckTx(smallTx, nil, mempool.TxInfo{SenderID: 1})) | |
require.NoError(t, txmp.CheckTx(smallTx, nil, mempool.TxInfo{SenderID: 2})) |
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.
no the sender can be the same. It's okay for the txs to be sent by the same peer. You might be confusing it with sender
in CheckTx
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.
Sorry I don't follow. Is this line referencing the sender
in CheckTx
?
// smaller low priority tx with different sender | ||
smallTx := []byte(fmt.Sprintf("sender-2-1=%X=1", smallPrefix)) | ||
require.NoError(t, txmp.CheckTx(bigTx, nil, mempool.TxInfo{SenderID: 1})) | ||
require.NoError(t, txmp.CheckTx(smallTx, nil, mempool.TxInfo{SenderID: 1})) |
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.
require.NoError(t, txmp.CheckTx(smallTx, nil, mempool.TxInfo{SenderID: 1})) | |
require.NoError(t, txmp.CheckTx(smallTx, nil, mempool.TxInfo{SenderID: 2})) |
…1113) ## Description This modifies the behavior of the `ReapMaxBytesMaxGas` method called by consensus. Prior we would return the tx set the moment the first tx was greater than the limit. Now instead of breaking we continue through all txs. This means that a large tx doesn't block smaller less priority transactions from getting through. (cherry picked from commit 793ece9)
Apparently at some point the behavior of the CosmosSDK changed again and it now allows transactions transactions with ascending sequence numbers into the mempool. This behavior change is going to result in annoying behavior where the block proposer will now start proposing sequences out of order under congestion. |
I don't think this PR is a good idea. |
thanks this is definitely something I'll look into.
fwiw since all PFB transactions included in a block must be valid, proposers filter invalid txs out. Which results in a perhaps equally unwanted behavior, where if the txs' are out of order, the higher sequence will be dropped that block and the lower sequence will be included. However the lower sequenced tx will be included. |
Description
This modifies the behavior of the
ReapMaxBytesMaxGas
method called by consensus. Prior we would return the tx set the moment the first tx was greater than the limit. Now instead of breaking we continue through all txs. This means that a large tx doesn't block smaller less priority transactions from getting through.PR checklist
.changelog
(we useunclog to manage our changelog)
docs/
orspec/
) and code comments