forked from 0xPolygon/polygon-edge
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ibft] Get txpool transactions all at once when building block (#176)
# Description The `txpool` prepare, push and pop transactions to hundreds of thousands heaps, it would be bad performance when the active accounts are huge amount (e.g. 100 kilo). Besides, it is a bad pattern that the `ibft` module knew too much details of the `txpool`. The idea was heavily inspired by the [go-ethereum](https://github.com/ethereum/go-ethereum) and [harmony](https://github.com/harmony-one/harmony). The PR : * Removes the 'demote' flags of the `server` command. * Whose function causes transactions to be discarded irreversibly. * Reduces the interface exposure of `txpool`. * Supply more capsuled interface. * Get transactions only once when building block in `ibft` module. * Use only one heap, maximum its performance. * The heap is sorted in price, and received time. * The transaction queues are nonce sorted in slice. * Would not insert new transactions, which is unnecessary when the block generation time is very short. # Changes include - [x] Bugfix (non-breaking change that solves an issue) - [ ] Hotfix (change that solves an urgent issue, and requires immediate attention) - [x] New feature (non-breaking change that adds functionality) - [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality) # Checklist - [x] I have assigned this PR to myself - [x] I have added at least 1 reviewer - [x] I have added the relevant labels - [ ] I have updated the official documentation - [x] I have added sufficient documentation in code ## Testing - [x] I have tested this code with the official test suite - [ ] I have tested this code manually ### Manual tests #### 1 node pprof test * Set up a pos mode server with `pprof` flag set. * Send huge amount transactions of different accounts using some tool. * Check cpu usage and heatmap. The node should perform OK in this branch, and yields bad performance in the target branch. #### 4 nodes network test Not done yet. # Documentation update Will update documentation once it merged.
- Loading branch information
1 parent
999ba6f
commit 5e07351
Showing
9 changed files
with
449 additions
and
206 deletions.
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
Oops, something went wrong.