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

Transaction pool only reduces single transaction per block even though lots of transaction in pool #7240

Open
wnjoon opened this issue Jun 19, 2024 · 4 comments
Labels
non mainnet (private networks) not related to mainnet features - covers privacy, permissioning, IBFT2, QBFT

Comments

@wnjoon
Copy link

wnjoon commented Jun 19, 2024

Scenario

  1. send 100 transactions to besu free-gas network, not waiting for mined (async)
  2. almost 100 transactions added to txpool (checked by besu_txpoolStatistics)
  3. however, only single transaction is reduced from txpool

here is my configurations

genesis.json

{
    "config" : {
      "chainId" : 1337,
      "homesteadBlock": 0,
      "daoForkBlock": 0,
      "eip150Block": 0,
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0,
      "constantinopleBlock": 0,
      "constantinoplefixblock" : 0,
      "muirGlacierBlock": 0,
      "berlinBlock": 0,
      "londonBlock": 0,
      "zeroBaseFee": true,
      "arrowGlacierBlock": 0,
      "grayGlacierBlock": 0,
      "qbft": {
        "epochlength": 30000,
        "blockperiodseconds": 3,
        "requesttimeoutseconds": 10
      },
      "contractSizeLimit": 2147483647
    },
    "nonce" : "0x0",
    "timestamp" : "0x58ee40ba",
    "gasLimit" : "0x1fffffffffffff",
    "difficulty" : "0x1",
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "mixHash" : "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
    "extraData": "0xf83aa00000000000000000000000000000000000000000000000000000000000000000d59493917cadbace5dfce132b991732c6cda9bcc5b8ac080c0",
    "coinbase" : "0x0000000000000000000000000000000000000000",
    "alloc" : {
    }
  }

run script

#!/bin/bash

ID=$1
BOOTNODEIP=127.0.0.1
LOGLEVEL=DEBUG

if [ -d nodes/node${ID} ]; then
      rm -Rf nodes/node${ID}
fi

sleep 1

besu \
 --genesis-file=nodes/config/genesis.json \
 --node-private-key-file=nodes/config/keys/node${ID} \
 --p2p-host=0.0.0.0 \
 --p2p-port=3030${ID} \
 --host-allowlist=* \
 --Xdns-enabled=true \
 --rpc-http-enabled=true \
 --rpc-http-host=0.0.0.0 \
 --rpc-http-port=2200${ID} \
 --rpc-http-api=EEA,WEB3,ETH,NET,TRACE,DEBUG,ADMIN,TXPOOL,PERM,QBFT \
 --rpc-ws-enabled=true \
 --rpc-ws-host=0.0.0.0 \
 --rpc-http-cors-origins=* \
 --rpc-ws-port=2300${ID} \
 --rpc-ws-api=EEA,WEB3,ETH,NET,TRACE,DEBUG,ADMIN,TXPOOL,PERM,QBFT \
 --graphql-http-enabled=true \
 --graphql-http-host=0.0.0.0 \
 --graphql-http-port=2400${ID} \
 --bootnodes=enode://8208a3f344695d44e9cf2c023683cbea7b9343e2f70a5e804bd2c93858e945f8f91439eef96a4ab6c47ff06637d6fbe6472f96de1655a1bee57ea896654f3a22@${BOOTNODEIP}:30301 \
 --discovery-enabled=true \
 --metrics-enabled=true \
 --metrics-host=0.0.0.0 \
 --metrics-port=3200${ID} \
 --min-gas-price=0 \
 --tx-pool-limit-by-account-percentage=1 \
 --logging=${LOGLEVEL} \
 --data-path=nodes/node${ID}/data ;

application is configured using free-gas-network written in official docs.
I guess since all transactions are added to txpool simultaneously and it means sending is not a problem. and nework setting is might be problem.

thanks.

@wnjoon wnjoon changed the title Transaction pool is only reduce single transaction per block even though lots of transaction in pool Transaction pool only reduces single transaction per block even though lots of transaction in pool Jun 19, 2024
@non-fungible-nelson
Copy link
Contributor

non-fungible-nelson commented Jun 24, 2024

Hi there - are you sending all of the transactions from the same account? and with the same nonce? are you incrementing the nonce? I am not sure how you are sending these txs, probably web3j. There may be documentation on how to increment the nonce on that side. If there is a nonce gap as well, that could cause issues.

Transactions with the same sender and same nonce will not be included and are considered invalid. Nonces cannot be re-used. Let me know if this was helpful or if there is more of a bug here that we can try to reproduce.

@non-fungible-nelson non-fungible-nelson added non mainnet (private networks) not related to mainnet features - covers privacy, permissioning, IBFT2, QBFT bug Something isn't working and removed bug Something isn't working labels Jun 24, 2024
@wnjoon
Copy link
Author

wnjoon commented Jun 25, 2024

@non-fungible-nelson

Thanks for response. I sent transactions from various users to itself so nonce didnt affect any problems.

But I found a different issue, caused by 'gas limit'.
Since I use go-ethereum for sending transaction to besu, I allocated all values to genesis.json for free-gas network.
(https://besu.hyperledger.org/development/private-networks/how-to/configure/free-gas)

But when I set same gas limit inside go-ethereum while building transaction, It always send single transaction even though there is enough usable gas.

tx := types.NewTx(&types.LegacyTx{
 ...
 Gas: uint64(9007199254740990)
}

But when client calculates gas limit real-time and allocate it to transaction (using ethclient.EstimateGas), lots of transactions can be sent in single block.
If client uses less than highest gas limit (9007199254740990), many transactions allocated to single block, but not as many as when calculating gas limit real-time.

Here is my assumptions.

  1. If client sets gas limit higher, Besu uses more gas even though it doesnt need to use that amount to send transaction.
  2. Since Besu is programmed by java, type of gas limit is little bit different between java and golang.

Is there someone can help me?

@fab-10
Copy link
Contributor

fab-10 commented Jun 26, 2024

Please report the Besu configuration overview that is printed at the beginning just after you start it, because I am not sure which txpool implementation you are using

@duync2006
Copy link

duync2006 commented Jul 1, 2024

I have the same issue as @wnjoon. I used --tx-pool="sequence".
I tried switching to the 'layered' txpool type, but it still the same problem

Here my genesis file

{	
  "config" : {
    "chainId" : 7777,
    "homesteadBlock" : 0,
    "daoForkBlock" : 0,
    "daoForkSupport" : true,
    "eip150Block" : 0,
    "eip150Hash" : "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0",
    "eip155Block" : 0,
    "eip158Block" : 0,
    "byzantiumBlock" : 0,
    "constantinopleBlock" : 0,
    "petersburgBlock": 0,
    "istanbulBlock":0,
    "muirGlacierBlock" : 0,
    "berlinBlock" : 0,
    "londonBlock" : 0,
    "arrowGlacierBlock" : 0,
    "grayGlacierBlock" : 0,
    "parisBlock" : 0,
    "shanghaiTime" : 0,
    "cancunTime" : 0,
    "zeroBaseFee" : true,
    "qbft" : {
      "blockperiodseconds" : 2,
      "epochlength" : 30000,
      "requesttimeoutseconds" : 4
    }
  },
  "nonce" : "0x0",
  "timestamp" : "0x58ee40ba",
  "gasLimit" : "0x1fffffffffffff",
  "difficulty" : "0x1",
  "mixHash" : "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
  "coinbase" : "0x0000000000000000000000000000000000000000",
  "alloc" : {
    "0fe2c00ca55f25655a6c49a359552ab4c176a883" : {
      "comment" : "Node 1 address",
      "balance" : "1000000000000000000000000000"
    },
    "8b819fc1afb3be79b561939411fc4cd91bbe3b3f" : {
      "comment" : "Node 2 address",
      "balance" : "1000000000000000000000000000"
    },
    "d1aaa514cfda4b16e914c315f181f8f2ffb626af" : {
      "comment" : "Node 3 address",
      "balance" : "1000000000000000000000000000"
    },
    "fd6bc1c8a1fe39f93247d91bdfd9ea0dfe1cdabd" : {
      "comment" : "Node 4 address",
      "balance" : "1000000000000000000000000000"
    },
    "76E046c0811edDA17E57dB5D2C088DB0F30DcC74" : {
      "balance" : "1000000000000000000000000000"
    },
    "79310C4f47e1CC21eB7e3BE7aAF15D79b3d1b2d1" : {
      "balance" : "1000000000000000000000000000"
    }
  },
  "extraData" : "0xf87aa00000000000000000000000000000000000000000000000000000000000000000f854940fe2c00ca55f25655a6c49a359552ab4c176a883948b819fc1afb3be79b561939411fc4cd91bbe3b3f94d1aaa514cfda4b16e914c315f181f8f2ffb626af94fd6bc1c8a1fe39f93247d91bdfd9ea0dfe1cdabdc080c0"
}

here is config.toml file:

ata-path="./data"

genesis-file="../networkFiles/genesis_v1.0.json"

profile="private"

rpc-http-enabled=true
rpc-http-api=["ETH","NET","QBFT","TXPOOL","WEB3"]
rpc-http-cors-origins=["all"]
rpc-http-host="0.0.0.0"
rpc-http-port=8545
rpc-http-max-active-connections=10000  #The maximum number of allowed HTTP JSON-RPC connections.
rpc-gas-cap=50000000

rpc-ws-enabled=true
rpc-ws-api=["ETH","NET","IBFT"]
rpc-ws-host="0.0.0.0"
rpc-ws-port=8546

host-allowlist=["*"]

p2p-host="178.128.116.25"
p2p-port=30303

min-gas-price=0
#min priority gas price

## TXPOOL
#tx-pool="sequenced"
#tx-pool-enable-save-restore=true
#tx-pool-limit-by-account-percentage=1
#tx-pool-retention-hours=1

tx-pool="layered"
tx-pool-enable-save-restore=true
tx-pool-max-future-by-sender="250"
#tx-pool-price-bump=0

revert-reason-enabled=true
rpc-max-logs-range=0

The besu version i used is 24.5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non mainnet (private networks) not related to mainnet features - covers privacy, permissioning, IBFT2, QBFT
Projects
None yet
Development

No branches or pull requests

4 participants