erigon icon indicating copy to clipboard operation
erigon copied to clipboard

Unequal transactions number included into block from transaction pool (reproduced on DEV chain)

Open Serhy opened this issue 2 years ago • 1 comments

System information

Erigon version: erigon version 2022.99.99-dev-2a0fda33

OS & Version: OSX Version 12.3.1

Commit hash : 2a0fda33

Expected behaviour

Transactions always picked up from transactions pool in batches

Actual behaviour

All the list of EIP1559 transactions in transaction pool which are not "fit" into the first block are picked up one by one. Please see description of issue

There are few ways to send many transactions but I use the next way: a) Taking into account current nonce = web3.eth.get_transaction_count(address) and we need to send X number of transactions: send transaction with (nonce + 1) then (nonce + 2) then (nonce + 1) ........ (nonce + X + 1) (they will stay in transaction pool in that case pending transactions) b) Now send transaction with the current account nonce value

In that case once transaction from (b) step is mined all the rest transactions from transaction pool are picked up

Steps to reproduce the behaviour

  1. Start the DEV network (DEV_CHAIN.md) (I use single node)
  2. Send 300 transactions from single account starting with the the nonce = web3.eth.get_transaction_count(address)+ 1 value till the nonce = web3.eth.get_transaction_count(address)+ 300 + 1
  3. Send 1 transaction with the current nonce=web3.eth.get_transaction_count(address) Actual result: about 150-170 transactions included in the first block. All the rest transactions are picked up one by one thus producing > 100 blocks having single transaction

Backtrace

logs from erigon dev network for above steps: erigon_300_tx.log

Serhy avatar Jul 20 '22 15:07 Serhy

@leonardchinonso we will take this one if you don't mind?

revitteth avatar Aug 11 '22 20:08 revitteth

Also you can reproduce easily using automated-testing repo with the test dedicated to this:

  1. Clone the repo https://github.com/ledgerwatch/automated-testing
  2. Create environment as described here: https://github.com/ledgerwatch/automated-testing#how-to-configure-the-environment-for-the-project
  3. Start your erigon DEV node and rpcdaemon
  4. Now, run the test: python -m pytest tests/test_block_creation_mvp.py::TestMVPTestCase::test_batch_of_valid_transactions --no-skips
  5. Keep an eye on erigon stdout (there are logs similar to what attached in description

Serhy avatar Sep 20 '22 08:09 Serhy

The issue is not reproducible anymore, so should be closed

yevh-berdnyk avatar Oct 27 '22 14:10 yevh-berdnyk