bsc icon indicating copy to clipboard operation
bsc copied to clipboard

txpool: buffer so that we dont delete txs

Open emailtovamos opened this issue 1 year ago • 3 comments

Description

To ensure we don't have to let go of valid authentic transactions just because the txpool is full, here's a potential mechanism of keeping the transactions in memory which would have been otherwise deleted. Then time to time the txpool can be checked if it is truly full. If it is not then these buffered transactions can be included.

Rationale

This is to ensure we keep as many transactions as possible without significantly affecting networking.

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

emailtovamos avatar May 30 '24 18:05 emailtovamos

Hi, why not increase txpool slot size to buffer more txs? what is the difference between them?

galaio avatar Jun 04 '24 08:06 galaio

@galaio that would mean in the entire network the number is increased which will come with extra load for every one. In the current PR case the more performant nodes will ensure the number of dropped transactions is less while still ensuring the total overall networking load isn't as much as the first case but rather delayed and distributed across time.

@brilliant-lx did you have any other justification behind this?

emailtovamos avatar Jun 04 '24 09:06 emailtovamos

@galaio that would mean in the entire network the number is increased which will come with extra load for every one. In the current PR case the more performant nodes will ensure the number of dropped transactions is less while still ensuring the total overall networking load isn't as much as the first case but rather delayed and distributed across time.

@brilliant-lx did you have any other justification behind this?

I was wondering if we can just increase the current TxPool slot size along with some tx broadcast mechanism change, like:

  • rate limit control: stop broadcast txs to all the peers once broadcastTPS > thresholdTPS(3000?)
  • once rate limit reached: only broadcast txs a few nodes(3 nodes by default?), or introduce a new concept like "SuperPeer". BSC's TxPool topology could be different from Ethereum, BSC can have "NormalPeer" and "SuperPeer", SuperPeer could have a giant TxPool size.

And for this PR, I think it is simple and can help avoid TX from been disappeared from the network, but I wonder if we can have other better solutions.

brilliant-lx avatar Jun 04 '24 13:06 brilliant-lx