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

Mempool: improve selection algorithm #6581

Merged
merged 78 commits into from
Nov 20, 2024
Merged

Conversation

andreibancioiu
Copy link
Collaborator

@andreibancioiu andreibancioiu commented Nov 4, 2024

Reasoning behind the pull request

  • Transactions selection (from mempool) is sub-optimal: sorting is sub-optimal, while the volume of selected transactions isn't wisely measured / capped (and, in conjunction with the front-running protection, this sometimes produces undesirable effects - blocks not being full).
  • Scheduled processing interacts with the transactions selection & nonce notification, and leads to sub-optimal processing of transactions (and blocks not being full).

Proposed changes

  1. Integrate the changes from Improve selection algorithm mx-chain-storage-go#55 - transactions are selected with respect to their price per gas unit.
  2. When selecting transactions, use an upper bound of the accumulated gas.
  3. Feed an account nonce provider (backed by an accounts adapter) to shardedTxPool - see (4).
  4. When adding a transaction to the mempool, inform it about the current nonce of the sender.
  5. Upon regular or scheduled processing, notify the mempool, inform it about current account nonces.
  6. When reverting a block, ask the mempool to forget about all known nonces. This is slightly suboptimal (but should be fine in practice) - we should have asked the mempool to do a selective forget (only for the senders that participated in the reverted block) - left as future work.

Testing procedure

  • Standard testing
  • Heavy load, to trigger evictions from the mempool
  • Trigger reverted blocks

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

andreibancioiu and others added 30 commits July 10, 2024 00:10
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from sstanculeanu Nov 15, 2024
@multiversx multiversx deleted a comment from sstanculeanu Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
sasurobert
sasurobert previously approved these changes Nov 15, 2024
sstanculeanu
sstanculeanu previously approved these changes Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
@multiversx multiversx deleted a comment from github-actions bot Nov 15, 2024
Copy link

📊 MultiversX Automated Test Report: View Report

🔄 Build Details:

  • mx-chain-go Commit Hash: 3ddc19fa402d74d2457bbb2a093c150e7656f9ed
  • Current Branch: selection-by-ppu
  • mx-chain-go Target Branch: rc/spica-patch-mempool
  • mx-chain-simulator-go Target Branch: selection-by-ppu
  • mx-chain-testing-suite Target Branch: main

🚀 Environment Variables:

  • TIMESTAMP: 15112024-133636
  • PYTEST_EXIT_CODE: 0
    🎉 MultiversX CI/CD Workflow Complete!

@andreibancioiu andreibancioiu changed the base branch from rc/spica-patch-mempool to feat/mempool November 20, 2024 13:39
@andreibancioiu andreibancioiu dismissed sstanculeanu’s stale review November 20, 2024 13:39

The base branch was changed.

@andreibancioiu andreibancioiu merged commit 4d7e013 into feat/mempool Nov 20, 2024
9 checks passed
@andreibancioiu andreibancioiu deleted the selection-by-ppu branch November 20, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants