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: sender mempool impl #13888

Merged
merged 60 commits into from
Nov 23, 2022
Merged

Conversation

JeancarloBarrios
Copy link
Contributor

@JeancarloBarrios JeancarloBarrios commented Nov 16, 2022

Description

A summary of this mempool's behavior:

  1. Maintain a separate list of nonce ordered txs per sender
  2. For each select iteration, randomly choose a sender and pick the next nonce ordered tx from their list
  3. Repeat 1,2 until the mempool is exhausted

Note that PrepareProposal could choose to stop iteration before reaching the end if maxBytes is reached.


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)

@JeancarloBarrios JeancarloBarrios requested a review from a team as a code owner November 16, 2022 13:53
@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

Merging #13888 (847bcf5) into main (2739f83) will increase coverage by 0.03%.
The diff coverage is 93.49%.

❗ Current head 847bcf5 differs from pull request most recent head cb6121e. Consider uploading reports for the commit cb6121e to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13888      +/-   ##
==========================================
+ Coverage   56.25%   56.29%   +0.03%     
==========================================
  Files         667      667              
  Lines       56576    56634      +58     
==========================================
+ Hits        31829    31884      +55     
- Misses      22165    22166       +1     
- Partials     2582     2584       +2     
Impacted Files Coverage Δ
types/mempool/sender_nonce.go 93.44% <93.44%> (ø)
baseapp/baseapp.go 76.76% <100.00%> (ø)
x/group/keeper/keeper.go 56.47% <0.00%> (+0.39%) ⬆️
crypto/keys/internal/ecdsa/privkey.go 83.01% <0.00%> (+1.88%) ⬆️

types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
@JeancarloBarrios JeancarloBarrios marked this pull request as draft November 16, 2022 14:16
@JeancarloBarrios JeancarloBarrios changed the title draft sender mempool impl feat: sender mempool impl Nov 16, 2022
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
@alexanderbez alexanderbez added C:ABCI backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release labels Nov 16, 2022
types/mempool/sender_nonce.go Fixed Show resolved Hide resolved
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
types/mempool/sender_nonce.go Fixed Show fixed Hide fixed
Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
Copy link
Member

@kocubinski kocubinski left a comment

Choose a reason for hiding this comment

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

LGTM, a couple suggestions in the generative testing.

types/mempool/sender_nonce.go Outdated Show resolved Hide resolved
types/mempool/sender_nonce.go Outdated Show resolved Hide resolved
types/mempool/sender_nonce.go Outdated Show resolved Hide resolved
@JeancarloBarrios JeancarloBarrios requested a review from a team November 23, 2022 15:20
@amaury1093 amaury1093 self-assigned this Nov 23, 2022
@sonarcloud
Copy link

sonarcloud bot commented Nov 23, 2022

[Cosmos SDK] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

95.7% 95.7% Coverage
0.0% 0.0% Duplication

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, I would say if we have any mention of nonce mempool in changelog we should remove and replace with this. Ill wrap up the docs I started this morning with the updated design

@tac0turtle tac0turtle merged commit 908fda1 into main Nov 23, 2022
@tac0turtle tac0turtle deleted the JeancarloBarrios/random-sender-nonce-ordering branch November 23, 2022 23:15
mergify bot pushed a commit that referenced this pull request Nov 23, 2022
* draft sender mempool impl

* select

* nit

* random sender update

* nit

* prevent memory leak

* fix nil return

* small fixes

* added tests

* change count

* finish tx order test removed the three address test due to make the test to bloated when including non determinism

* remove unsued variable

* nit

* fix

* temoral commit braking

* nit most

* nit most

* final

* comments

* t

* comments

* test

* add nolint

* Fix comment

* golint comment

* golint

* improve format?

* more gosec disable

* Fix ctr usage

* use #nosec

* Update types/mempool/sender_nonce.go

* Kocubinski/random sender nonce (#13956)

* refactor

* fix iteration logic

* fix merge err

* import fixes

* derive order randomness from seed only

* gosec fix

* ignore gosec again

* comments

* property based

* minor fixes

* added property test

* comment

* fix imports

* comment

* Update types/mempool/sender_nonce_property_test.go

Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>

* remove unesessary loop

* improve function name

* Update types/mempool/sender_nonce.go

Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>

* change import name

* change validation to be preemvtive

Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
(cherry picked from commit 908fda1)

# Conflicts:
#	types/mempool/nonce.go
JeancarloBarrios added a commit that referenced this pull request Nov 24, 2022
tac0turtle pushed a commit that referenced this pull request Nov 24, 2022
* feat: sender mempool impl (#13888)

* draft sender mempool impl

* select

* nit

* random sender update

* nit

* prevent memory leak

* fix nil return

* small fixes

* added tests

* change count

* finish tx order test removed the three address test due to make the test to bloated when including non determinism

* remove unsued variable

* nit

* fix

* temoral commit braking

* nit most

* nit most

* final

* comments

* t

* comments

* test

* add nolint

* Fix comment

* golint comment

* golint

* improve format?

* more gosec disable

* Fix ctr usage

* use #nosec

* Update types/mempool/sender_nonce.go

* Kocubinski/random sender nonce (#13956)

* refactor

* fix iteration logic

* fix merge err

* import fixes

* derive order randomness from seed only

* gosec fix

* ignore gosec again

* comments

* property based

* minor fixes

* added property test

* comment

* fix imports

* comment

* Update types/mempool/sender_nonce_property_test.go

Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>

* remove unesessary loop

* improve function name

* Update types/mempool/sender_nonce.go

Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>

* change import name

* change validation to be preemvtive

Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
(cherry picked from commit 908fda1)

# Conflicts:
#	types/mempool/nonce.go

* feat: sender mempool impl (#13888)

Co-authored-by: Jeancarlo Barrios <JeancarloBarrios@users.noreply.github.com>
Co-authored-by: Jeancarlo <jeancarlobarrios@gmail.com>
@kocubinski kocubinski mentioned this pull request Nov 28, 2022
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release C:ABCI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants