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

feat: add mempool interfaces #13249

Merged
merged 8 commits into from
Sep 13, 2022
Merged

feat: add mempool interfaces #13249

merged 8 commits into from
Sep 13, 2022

Conversation

kocubinski
Copy link
Member

@kocubinski kocubinski commented Sep 12, 2022

Description

Ref: #13150
Followed by: #13262

I am proposing Select(...) instead of ReapMaxBytes(...) as in ADR-60, since the ProcessProposal steps can be simplified from

  1. Reap one or more transactions from the priority queue and collect them into one of two buffers -- valid and invalid.
  2. For transactions that DO NOT violate the nonce validation, they are included in the valid buffer.
  3. For transactions that DO violate the nonce validation, they are included in the invalid buffer.
  4. Continue this process until the desired number of valid transactions are reaped or until the mempool is empty.
  5. Provide Tendermint the list of all transactions from the valid buffer.
  6. Re-insert all transactions, from both buffers, back into app-side mempool.

to

  1. Select valid transactions which do not violate nonce validation from the mempool up to maxBytes.
  2. Provider Tendermint the list of transactions

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@codecov
Copy link

codecov bot commented Sep 13, 2022

Codecov Report

Merging #13249 (fbaca0b) into main (c32493a) will increase coverage by 0.23%.
The diff coverage is 41.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13249      +/-   ##
==========================================
+ Coverage   54.78%   55.02%   +0.23%     
==========================================
  Files         660      653       -7     
  Lines       56914    55521    -1393     
==========================================
- Hits        31182    30549     -633     
+ Misses      23232    22519     -713     
+ Partials     2500     2453      -47     
Impacted Files Coverage Δ
baseapp/abci.go 67.01% <ø> (ø)
types/context.go 88.81% <ø> (ø)
types/tx_msg.go 100.00% <ø> (ø)
x/auth/tx/builder.go 80.19% <0.00%> (-0.54%) ⬇️
baseapp/baseapp.go 77.12% <50.00%> (-0.82%) ⬇️
x/distribution/simulation/operations.go 80.64% <0.00%> (-9.68%) ⬇️
crypto/keys/internal/ecdsa/privkey.go 81.13% <0.00%> (-1.89%) ⬇️
simapp/simd/cmd/testnet.go
simapp/export.go
simapp/utils.go
... and 15 more

@kocubinski kocubinski marked this pull request as ready for review September 13, 2022 14:30
@kocubinski kocubinski requested a review from a team as a code owner September 13, 2022 14:30
x/auth/tx/builder.go Outdated Show resolved Hide resolved
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

LGTM

@julienrbrt julienrbrt merged commit b96bed5 into main Sep 13, 2022
@julienrbrt julienrbrt deleted the kocubinski/mempool-interfaces branch September 13, 2022 19:25
// 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 {
Copy link
Contributor

Choose a reason for hiding this comment

The 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 mempool subpackage in baseapp/mempool.

Comment on lines +687 to +689

if err == nil {

Copy link
Contributor

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 :)

Wryhder pushed a commit to Wryhder/cosmos-sdk that referenced this pull request Oct 26, 2022
* working out interfaces

* integration to checkTx

* use struct fields directly in sz calculation

* fix typo

* nil guard on mempool

* Remove tx builder method

* impl with panic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants