-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: add mempool interfaces #13249
Merged
Merged
feat: add mempool interfaces #13249
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c6550eb
working out interfaces
kocubinski 42ca62d
integration to checkTx
kocubinski 9d69b4c
use struct fields directly in sz calculation
kocubinski 0890503
fix typo
kocubinski d610042
nil guard on mempool
kocubinski 8256b92
Remove tx builder method
kocubinski 3588a97
impl with panic
kocubinski fbaca0b
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocubinski/m…
kocubinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package types | ||
|
||
// MempoolTx we define an app-side mempool transaction interface that is as | ||
// minimal as possible, only requiring applications to define the size of the | ||
// transaction to be used when reaping and getting the transaction itself. | ||
// Interface type casting can be used in the actual app-side mempool implementation. | ||
type MempoolTx interface { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wish I had a chance to review this prior to merge. I really think this should not exist here. IMO all mempool logic should live in a |
||
Tx | ||
|
||
// Size returns the size of the transaction in bytes. | ||
Size() int | ||
} | ||
|
||
type Mempool interface { | ||
// Insert attempts to insert a MempoolTx into the app-side mempool returning | ||
// an error upon failure. | ||
Insert(Context, MempoolTx) error | ||
|
||
// Select returns the next set of available transactions from the app-side | ||
// mempool, up to maxBytes or until the mempool is empty. The application can | ||
// decide to return transactions from its own mempool, from the incoming | ||
// txs, or some combination of both. | ||
Select(ctx Context, txs [][]byte, maxBytes int) ([]MempoolTx, error) | ||
|
||
// CountTx returns the number of transactions currently in the mempool. | ||
CountTx() int | ||
|
||
// Remove attempts to remove a transaction from the mempool, returning an error | ||
// upon failure. | ||
Remove(Context, MempoolTx) error | ||
} |
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
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
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.
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.
@kocubinski please. undo these changes in #13262 :)