openethereum / parity-ethereum

The fast, light, and robust client for Ethereum-like networks.
Other
6.83k stars 1.69k forks source link

Out of gas txs stuck in the txqueue in PoA network #6342

Closed phahulin closed 6 years ago

phahulin commented 7 years ago

Hello, everyone

I'm running:

  • Parity version: Parity/v1.7.0-beta-5f2cabd-20170727/x86_64-linux-gnu/rustc1.18.0
  • Operating system: Linux Ubuntu 16.04.1
  • And installed: via binary

We have a PoA network with validators via contract. Nodes are connected and generate blocks - that's all OK. Here is spec.json Here is node.toml from one of the mining nodes:

# AlphaTestTestNet branch
[parity]
chain = "spec.json"
base_path = "parity"
[network]
nat="extip:$EXT_IP"
bootnodes=["enode://..."]
port = 30300
discovery=true
[rpc]
cors = "all"
interface = "all"
hosts = ["all"]
port = 8540
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
[account]
password = ["node.pwd"]
unlock = ["0xd637767e6f97dc1b0f5022618706e986891fd804"]
[mining]
force_sealing = true
engine_signer = "0xd637767e6f97dc1b0f5022618706e986891fd804"
reseal_on_txs = "none"

If miner tries to deploy some other regular contract that exceeds gas limit (here a default truffle's migration contract is being deployed), his transaction will not be rejected (these logs are obtain with parity -l engine=trace,tx=trace,txqueue=trace,own_tx=trace,miner=trace)

2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  update_sealing
2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  requires_reseal: sealing enabled
2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  requires_reseal: should_disable_sealing=false; best_block=63185, last_request=0
2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  update_sealing: preparing a block
2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  prepare_block: No existing work - making new block
2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  Pushed 0/0 transactions
2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  update_sealing: engine indicates internal sealing
2017-08-21 09:30:50 UTC IO Worker #1 TRACE miner  seal_block_internally: attempting internal seal.
2017-08-21 09:30:50 UTC IO Worker #1 TRACE engine  Fetched proposer for step 300661570: 5e77…d128
2017-08-21 09:30:50 UTC IO Worker #1 TRACE engine  generate_seal: d637…d804 not a proposer for step 300661570.
2017-08-21 09:30:54 UTC  TRACE own_tx  Importing transaction: PendingTransaction { transaction: SignedTransaction { transaction: UnverifiedTransaction { unsigned: Transaction { nonce: 150, gas_price: 100000000000, gas: 4712388, action: Create, value: 0, data: [96, 96, 96, 64, 82, 52, 21, 97, 0, 15, 87, 96, 0, 128, 253, 91, 91, 96, 0, 128, 84, 96, 1, 96, 160, 96, 2, 10, 3, 25, 22, 51, 96, 1, 96, 160, 96, 2, 10, 3, 22, 23, 144, 85, 91, 91, 97, 1, 229, 128, 97, 0, 60, 96, 0, 57, 96, 0, 243, 0, 96, 96, 96, 64, 82, 99, 255, 255, 255, 255, 124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 53, 4, 22, 99, 9, 0, 240, 16, 129, 20, 97, 0, 94, 87, 128, 99, 68, 93, 240, 172, 20, 97, 0, 127, 87, 128, 99, 141, 165, 203, 91, 20, 97, 0, 164, 87, 128, 99, 253, 172, 213, 118, 20, 97, 0, 211, 87, 91, 96, 0, 128, 253, 91, 52, 21, 97, 0, 105, 87, 96, 0, 128, 253, 91, 97, 0, 125, 96, 1, 96, 160, 96, 2, 10, 3, 96, 4, 53, 22, 97, 0, 235, 86, 91, 0, 91, 52, 21, 97, 0, 138, 87, 96, 0, 128, 253, 91, 97, 0, 146, 97, 1, 130, 86, 91, 96, 64, 81, 144, 129, 82, 96, 32, 1, 96, 64, 81, 128, 145, 3, 144, 243, 91, 52, 21, 97, 0, 175, 87, 96, 0, 128, 253, 91, 97, 0, 183, 97, 1, 136, 86, 91, 96, 64, 81, 96, 1, 96, 160, 96, 2, 10, 3, 144, 145, 22, 129, 82, 96, 32, 1, 96, 64, 81, 128, 145, 3, 144, 243, 91, 52, 21, 97, 0, 222, 87, 96, 0, 128, 253, 91, 97, 0, 125, 96, 4, 53, 97, 1, 151, 86, 91, 0, 91, 96, 0, 128, 84, 51, 96, 1, 96, 160, 96, 2, 10, 3, 144, 129, 22, 145, 22, 20, 21, 97, 1, 124, 87, 129, 144, 80, 128, 96, 1, 96, 160, 96, 2, 10, 3, 22, 99, 253, 172, 213, 118, 96, 1, 84, 96, 64, 81, 124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 255, 255, 255, 255, 132, 22, 2, 129, 82, 96, 4, 129, 1, 145, 144, 145, 82, 96, 36, 1, 96, 0, 96, 64, 81, 128, 131, 3, 129, 96, 0, 135, 128, 59, 21, 21, 97, 1, 103, 87, 96, 0, 128, 253, 91, 97, 2, 198, 90, 3, 241, 21, 21, 97, 1, 120, 87, 96, 0, 128, 253, 91, 80, 80, 80, 91, 91, 91, 80, 80, 86, 91, 96, 1, 84, 129, 86, 91, 96, 0, 84, 96, 1, 96, 160, 96, 2, 10, 3, 22, 129, 86, 91, 96, 0, 84, 51, 96, 1, 96, 160, 96, 2, 10, 3, 144, 129, 22, 145, 22, 20, 21, 97, 1, 180, 87, 96, 1, 129, 144, 85, 91, 91, 91, 80, 86, 0, 161, 101, 98, 122, 122, 114, 48, 88, 32, 108, 234, 136, 140, 245, 57, 120, 47, 185, 187, 157, 155, 233, 116, 191, 92, 46, 143, 188, 237, 35, 148, 16, 51, 34, 102, 175, 6, 137, 242, 38, 70, 0, 41] }, v: 25296896, r: 85958684512054125922881024122434810315738043737640594855323124833258656357840, s: 14143614474863145506591255791883398576786878061012156892982772619383263064944, hash: dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df }, sender: d637767e6f97dc1b0f5022618706e986891fd804, public: Some(b3468405b5d446de557b30fa29fb8d60e8720367f7555d645c178647595a5f5a29f531b823055ea6e42bf26dd57fe70a1d5cb621fcc8aa8aa5ea593ce535b103) }, condition: None }
2017-08-21 09:30:54 UTC  TRACE txqueue  Inserting: TransactionOrder { nonce_height: 0, gas_price: 100000000000, gas_factor: 53787704256, gas: 4712388, mem_usage: 640, strategy: GasPriceOnly, hash: dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df, insertion_id: 0, origin: Local, penalties: 0 }
2017-08-21 09:30:54 UTC  DEBUG txqueue  Imported transaction to current: dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df
2017-08-21 09:30:54 UTC  DEBUG txqueue  status: TransactionQueueStatus { pending: 1, future: 0 }
2017-08-21 09:30:54 UTC  DEBUG own_tx  Imported to Current (hash dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df)
2017-08-21 09:30:54 UTC  TRACE own_tx  Status: TransactionQueueStatus { pending: 1, future: 0 }
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  update_sealing
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  requires_reseal: sealing enabled
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  requires_reseal: should_disable_sealing=false; best_block=63185, last_request=0
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  update_sealing: preparing a block
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  prepare_block: No existing work - making new block
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  Adding tx dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df took Duration { secs: 0, nanos: 16000 }
2017-08-21 09:30:55 UTC IO Worker #0 DEBUG miner  Skipping adding transaction to block because of gas limit: dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df (limit: 4700000, used: 0, gas: 4712388)
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  Pushed 0/1 transactions
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  update_sealing: engine indicates internal sealing
2017-08-21 09:30:55 UTC IO Worker #0 TRACE miner  seal_block_internally: attempting internal seal.
2017-08-21 09:30:55 UTC IO Worker #0 TRACE engine  Fetched proposer for step 300661571: a487…30f7
2017-08-21 09:30:55 UTC IO Worker #0 TRACE engine  generate_seal: d637…d804 not a proposer for step 300661571.

but will get stuck in the queue, being skipped each round

2017-08-21 09:31:01 UTC Verifier #0 DEBUG engine  Author dd0b…7126 built block with step gap. current step: 300661572, parent step: 300661568
2017-08-21 09:31:01 UTC Verifier #0 DEBUG engine  Set of validators obtained: [dd0bb0e2a1594240fed0c2f2c17c1e9ab4f87126, d637767e6f97dc1b0f5022618706e986891fd804, 705a6dc970416cd7df97c75918609f4aeafbcf9f, 66d26d11af18d3d9f228ce242125fca02eb2713a, 5e77b956f7deb4a568ff687f2891c64ec678d128, a4877cce4249e2150bbb3b5b7b44afa3b6bf30f7, 09439c2abbaca1703c856669b2ed8aae7bbcfb9a, 14779640ed1f04c71106505f934d6e07e005c128, 236e21d03955ec7fcefef93276b68e2541c1e9de, bb08f4689e122baa71b1f92fe631033d9a8bcc75, 428c24cf37d4413236c7cc086c50415dd78d78e1, a48538e5b29ed540f4942584f248816d71e50493, 8353decb9b8bf0cc4b0359b85c92d4bd2699529e]
2017-08-21 09:31:01 UTC Verifier #0 TRACE engine  Fetched proposer for step 300661569: dd0b…7126
2017-08-21 09:31:01 UTC Verifier #0 TRACE engine  Fetched proposer for step 300661570: d637…d804
2017-08-21 09:31:01 UTC Verifier #0 TRACE engine  Fetched proposer for step 300661571: 705a…cf9f
2017-08-21 09:31:01 UTC Verifier #0 DEBUG engine  Expected topics for header 3e00…3058: [55252fa6eee4741b4e24a74a70e9c11fd2c2281df8d6ea13126ff845f7825c89, fc3dbb4ea326d8b97f36f0ed1e9faff83fcfbc707f2b170afec9cd5813e1be96]
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  chain_new_blocks
2017-08-21 09:31:01 UTC Verifier #0 DEBUG miner  minimal_gas_price: recalibrating...
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  Recalibrating Instant { tv_sec: 995121, tv_nsec: 83505607 } versus Instant { tv_sec: 998528, tv_nsec: 495346089 }
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  update_sealing
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  requires_reseal: sealing enabled
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  requires_reseal: should_disable_sealing=false; best_block=63186, last_request=0
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  update_sealing: preparing a block
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  prepare_block: No existing work - making new block
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  Adding tx dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df took Duration { secs: 0, nanos: 12200 }
2017-08-21 09:31:01 UTC Verifier #0 DEBUG miner  Skipping adding transaction to block because of gas limit: dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df (limit: 4700000, used: 0, gas: 4712388)
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  Pushed 0/1 transactions
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  update_sealing: engine indicates internal sealing
2017-08-21 09:31:01 UTC Verifier #0 TRACE miner  seal_block_internally: attempting internal seal.
2017-08-21 09:31:01 UTC Verifier #0 TRACE engine  Fetched proposer for step 300661572: dd0b…7126
2017-08-21 09:31:01 UTC Verifier #0 TRACE engine  generate_seal: d637…d804 not a proposer for step 300661572.
2017-08-21 09:31:01 UTC Verifier #0 INFO import  Imported #63186 3e00…3058 (0 txs, 0.00 Mgas, 674.22 ms, 0.56 KiB)
2017-08-21 09:31:01 UTC IO Worker #0 TRACE txqueue  Dropping already imported transaction: dcbbcf5a91f2b13a4b0d736adc6b9430e26249ab4850ab9007822641445216df

Truffle migration just hangs

Using network 'development'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0xc0e22c8150f9fb888510199d189a628fc6805265575973a8864ad4defe374a4b
^C

If you run contract deployment again, a second pending transaction will appear

2017-08-21 09:54:40 UTC Verifier #0 TRACE miner  Adding tx 65432cf7edc294eecb42e5ff9741e341fb4d39ae6fe7f852ce2288d4d1ba39a1 took Duration { secs: 0, nanos: 11600 }
2017-08-21 09:54:40 UTC Verifier #0 DEBUG miner  Skipping adding transaction to block because of gas limit: 65432cf7edc294eecb42e5ff9741e341fb4d39ae6fe7f852ce2288d4d1ba39a1 (limit: 4700000, used: 0, gas: 4712388
2017-08-21 09:54:40 UTC Verifier #0 TRACE miner  Adding tx c0e22c8150f9fb888510199d189a628fc6805265575973a8864ad4defe374a4b took Duration { secs: 0, nanos: 1600 }
2017-08-21 09:54:40 UTC Verifier #0 DEBUG miner  Skipping adding transaction to block because of invalid nonce: c0e22c8150f9fb888510199d189a628fc6805265575973a8864ad4defe374a4b (expected: 152, got: 153)
2017-08-21 09:54:40 UTC Verifier #0 TRACE miner  Pushed 0/2 transactions

We have a separate instance of our network (for real people to test), where there are 20+ transactions like this that have been hanging in queue for days.

If you send a valid tx from that address (e.g. transfer eth to someone), it will also remove one of the pending txs from the queue:

2017-08-21 09:55:10 UTC Verifier #0 DEBUG engine  Expected topics for header 1c4d…5717: [55252fa6eee4741b4e24a74a70e9c11fd2c2281df8d6ea13126ff845f7825c89, bcfd824a27fea83b5b743d8536eb185a3941daf18054556385b42585fe387baf]
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  chain_new_blocks
2017-08-21 09:55:10 UTC Verifier #0 DEBUG miner  minimal_gas_price: recalibrating...
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  Recalibrating Instant { tv_sec: 996570, tv_nsec: 53204878 } versus Instant { tv_sec: 998528, tv_nsec: 495346089 }
2017-08-21 09:55:10 UTC Verifier #0 TRACE txqueue  Removing old transaction: d6e98f400c77088de059e9af6222f4dab3047c5b27968a2dacf4c17224c5f9f0 (nonce: 152 < 153)
2017-08-21 09:55:10 UTC Verifier #0 INFO own_tx  Transaction mined (hash d6e98f400c77088de059e9af6222f4dab3047c5b27968a2dacf4c17224c5f9f0)
2017-08-21 09:55:10 UTC Verifier #0 DEBUG own_tx  Imported to Future (hash c0e22c8150f9fb888510199d189a628fc6805265575973a8864ad4defe374a4b)
2017-08-21 09:55:10 UTC Verifier #0 DEBUG own_tx  Imported to Current (hash c0e22c8150f9fb888510199d189a628fc6805265575973a8864ad4defe374a4b)
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  update_sealing
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  requires_reseal: sealing enabled
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  requires_reseal: should_disable_sealing=false; best_block=63332, last_request=0
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  update_sealing: preparing a block
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  prepare_block: No existing work - making new block
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  Adding tx c0e22c8150f9fb888510199d189a628fc6805265575973a8864ad4defe374a4b took Duration { secs: 0, nanos: 2000 }
2017-08-21 09:55:10 UTC Verifier #0 DEBUG miner  Skipping adding transaction to block because of gas limit: c0e22c8150f9fb888510199d189a628fc6805265575973a8864ad4defe374a4b (limit: 4700000, used: 0, gas: 4712388)
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  Pushed 0/1 transactions
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  update_sealing: engine indicates internal sealing
2017-08-21 09:55:10 UTC Verifier #0 TRACE miner  seal_block_internally: attempting internal seal.
2017-08-21 09:55:10 UTC Verifier #0 TRACE engine  Fetched proposer for step 300661862: 705a…cf9f
2017-08-21 09:55:10 UTC Verifier #0 TRACE engine  generate_seal: d637…d804 not a proposer for step 300661862.
2017-08-21 09:55:10 UTC Verifier #0 INFO import  Imported #63332 1c4d…5717 (1 txs, 0.02 Mgas, 0.62 ms, 0.68 KiB)

I did this test on a mining node, but it can also be reproduced by any node connected to the network. I think this is incorrect and invalid transaction should be removed from the queue.

5chdn commented 7 years ago

To accept transactions with more than 4.7 million gas, just run your sealing nodes with --gas-floor-target 6666666 (or any value you like).

To remove transactions from the pool, either restart your nodes with the --no-persistant-txqueue flag or replace them with transactions of same nonce but higher gas price (any simple transaction should do).

phahulin commented 7 years ago

But isn't this a potential DDoS attack vector? A malicious user can join the network and flood it with as many out-of-gas transactions as possible.

5chdn commented 7 years ago

A malicious user would require access to your PoA configuration (chain spec) and some decent amount of ETH to be able to DoS your network.

Reopening for a 2nd opinion.

phahulin commented 7 years ago

Well, our configuration is open as I've provided a link to spec.json in the first post. Please note, that this user even need not to be a validator, he just needs to connect and run truffle migrate

tomusdrw commented 7 years ago

Transactions significantly above current block gas limit are not accepted by other peers at all. If the transaction is a little bit above gas limit (up to 0.5%) it will be accepted, but evicted from the queue (after some time) when it's not mined. Also it will get a very low priority, so it's easily pushed out of the queue by other transactions in the network. Note that because the gas limit doesn't allow that we don't event attempt to run the transaction, so the only issues is that it can generate some network overhead when transactions are propagated.

keorn commented 7 years ago

Third party accounts will also have not access to the tokens on your PoA network so will be unable to submit a transaction in the first place. If you want to restrict connectivity since tokens are widely distributed, then use reserved peers.

You can only get your own account stuck, does not affect other accounts at all (try it on the mainnet).

phahulin commented 7 years ago

@tomusdrw what is the eviction period equal to?

tomusdrw commented 7 years ago

It's 128 blocks: https://github.com/paritytech/parity/blob/8500252e699b0b318b1707d71d368d5b9bc82985/ethcore/src/miner/transaction_queue.rs#L553

rstormsf commented 7 years ago

@tomusdrw @keorn @5chdn We have over 200k blocks already passed and none of the transactions were evicted. http://testnet.oracles.org:4000/tx/pending

  1. We tried replacing those transactions with higher gas limit - doesn't work
  2. The main issue for me is that I cannot use my account from Parity node(just sending a simple transfer transaction) makes it stuck in the network. However, if I send it the transaction from metamask which connnects to a different node - it goes thru. So, why I cannot send any transaction from parity node which were used to deploy truffle migration and generated all of those stuck transactions.

According to @tomusdrw comment for transaction_queue it should have already been rejected, why do we still see them?

Am I understanding it correctly that all nodes are keeping the transaction queue somewhere in memory?

Netstat: http://testnet.oracles.org:3000/

Here is when it gets interesting: When I send a tx from the same account that generated txs after some time, it goes thru and removes all pending tx that were previously generated by the same account. So now whoever generated pending tx, needs to create a new transaction in order for other pending txs to get kicked out.

To reproduce:

  1. https://gist.github.com/rstormsf/d88b37a8a7bdfb43feb54dd6e01a4dcc - node.toml + spec.json
  2. Feel free to use this private key: 8f3d8067ac097bd394eaa929787640002f0e6d802dfd452429394dd97987e66c (there are 64 OEther there) Public RPC node (for metamask) http://40.117.197.50:8545
tomusdrw commented 7 years ago

So most likely the node that initiated the transactions has all of them and keeps propagating them to the network. One of those transactions is being rejected by the mining/authority node - and rest of them goes to future. Sending another transaction renders different behaviour depending on the node, because:

  1. On the node that initiated the transaction the nonce that is used is the one after all of those transactions (new transactions is stuck)
  2. On the metamask node the nonce is the one that fills the gap.

It should be enough to stop the node that contains the account that initiated the transactions, wait until they are removed from the queue of the other node and restart the first node with --no-persistent-txqueue to clear the transactions that got stuck.

So to be clear: the transactions are evicted from the queue, but if there is at least one node that keeps propagating them they will be imported again.

That said, I'm considering removal of accepting "slightly above gas limit" transactions at all.

rstormsf commented 7 years ago

@tomusdrw Nope, I killed the node long time ago and all pending txs were still there. We waited ~ 200k blocks - (http://testnet.oracles.org:4000/tx/pending)

So how do I figure out which node keep propagating txs?
How do we clear pending tx now?

If I just run the node right now: -l engine=trace,tx=trace,txqueue=trace,own_tx=trace,miner=trace

here is what I see:

2017-08-25 13:12:00  Verifier #5 DEBUG miner  Skipping adding transaction to block because of invalid nonce: b16b41b748dfe6c11527477884c247201afaa3d0847695a7557c8ed52bef59f6 (expected: 1, got: 2)
2017-08-25 13:12:00  Verifier #5 TRACE miner  Adding tx 2a25cce7afd74eaed0145e2487cfbe72f26f17087b98ce028eb31eed786031d7 took Duration { secs: 0, nanos: 1342 }
2017-08-25 13:12:00  Verifier #5 TRACE miner  Adding tx c5c14a0c7ee1b49906323c5c09ce1b44855b373b9b3c41bdb2611a1bf840483b took Duration { secs: 0, nanos: 1181 }
.........
2017-08-25 13:12:00  Verifier #5 TRACE miner  Pushed 0/6 transactions
2017-08-25 13:12:00  Verifier #5 TRACE miner  update_sealing: engine is not keen to seal internally right now
2017-08-25 13:12:00  Verifier #5 INFO import  Imported #254288 11ad…12b0 (0 txs, 0.00 Mgas, 0.82 ms, 0.57 KiB)
2017-08-25 13:12:05  IO Worker #0 TRACE miner  update_sealing
2017-08-25 13:12:05  IO Worker #0 TRACE miner  requires_reseal: sealing enabled
2017-08-25 13:12:05  IO Worker #0 TRACE miner  requires_reseal: should_disable_sealing=false; best_block=254288, last_request=0
2017-08-25 13:12:05  IO Worker #0 TRACE miner  update_sealing: preparing a block
2017-08-25 13:12:05  IO Worker #0 TRACE miner  prepare_block: No existing work - making new block
2017-08-25 13:12:05  IO Worker #0 TRACE miner  Adding tx 2bea9e0999d807af27976dd65c3a49e1e7e1d009dd0ee331911e7a50a660617a took Duration { secs: 0, nanos: 93097 }
2017-08-25 13:12:05  IO Worker #0 DEBUG miner  Skipping adding transaction to block because of gas limit: 2bea9e0999d807af27976dd65c3a49e1e7e1d009dd0ee331911e7a50a660617a (limit: 4700000, used: 0, gas: 4712388)

Is there any idea on why truffle migrate generates pending tx.

tomusdrw commented 7 years ago

Ok, sorry I got confused. I thought that you meant that future queue is filled up with some transactions.

If the transactions are in the pending queue they will be re-propagated by all those nodes, we anticipate a block gas limit increase, but if it does not happen it won't ever be included.

To remove the transaction you need to replace the one that has this super high gas limit with something that can actually be mined (Parity 1.7 allows you to "cancel" transaction that is pending, and does exactly that afair).

rstormsf commented 7 years ago

why this issue is closed?

@tomusdrw yes the future tx is filled up with the same pending transactions and they never get killed.

when you said - you need to replace. There are some txs that were generated by some unknown users. That's why @phahulin mentioned that someone can just come to the network, generate bunch of pending tx that will never be killed to spam the network. What is the solution?

http://testnet.oracles.org:4000/tx/pending - we still have pending txs. How do we remove them?

Please feel free to take this private key: 8f3d8067ac097bd394eaa929787640002f0e6d802dfd452429394dd97987e66c

run parity against oracles network with these configs: https://gist.github.com/rstormsf/d88b37a8a7bdfb43feb54dd6e01a4dcc

try to simply truffle init && truffle migrate you will see how easy it is to generate pending txs that will never be killed to spam the network. Please try.

tomusdrw commented 7 years ago

@rstormsf The PR that lowers maximal gas of a single transaction is pending: #6408. The transactions are still valid, they are just awaiting for a miner willing to rise the block gas limit to accept them (alike low gas price transactions).

They occupy the queue, but they are getting a very low priority so they won't block other transactions from being included and they don't really cause any threat to the network. They cannot be killed from the queue, because other nodes are repropagating them (and they are allowed to do so with any valid transactions).

That said I do understand that you want to keep your queue clean though and not accept such transactions at all.

If you want to get rid of them the only way currently is to increase your gas floor target and mine a slightly bigger block to process them.

rstormsf commented 7 years ago

@tomusdrw Thank you for taking your time to understand our problem and submitting a PR. Looks like it's merged into master. We will test the change in our devtestnet and we will let you know.

Here is what I don't understand: How does Kovan network solves this problem? They always have 0 pending txs: https://kovan.etherscan.io/txsPending

If you want to get rid of them the only way currently is to increase your gas floor target and mine a slightly bigger block to process them.

Could you explain more on that? I don't believe that PoA Kovan chain is doing something like that in order to get rid of pending txs. I'd expect them to become invalid and stop propagating. So, you are suggesting to restart every validator's node with --gas-floor-target XXX, correct?

FYI - I don't fully understand how does this PR solves the problem if we still need to change gas floor target?

https://raw.githubusercontent.com/oraclesorg/oracles-scripts/alphadevtestnet/spec.json - OraclesPoA - here is our spec, maybe we should add some flags to it? In comparison to kovan.spec

Here is the diff between Kovan.spec.json vs OraclesPoA.spec.json:

1. In authorityRound they have those params which Oracles doesn't. Do you know what it does?

        "validateScoreTransition": 1000000,
        "validateStepTransition": 1500000

2. in params Kovan spec also have and Oracles-PoA does NOT:

    "gasLimitBoundDivisor": "0x400",
    "registrar": "0xfAb104398BBefbd47752E7702D9fE23047E1Bca3",
    "blockReward": "0x4563918244F40000",
    "validateReceiptsTransition": 1000000,
    "eip155Transition": 1000000

I suspect that maybe some of those missing flags can solve the problem. @tomusdrw what do you think? I think maybe gasLimitBoundDivisor has to be there ?

rstormsf commented 7 years ago

@tomusdrw if you may. I've seen @phahulin filed new issue #6429

tomusdrw commented 7 years ago

gasLimitBoundDivisor is indeed related. How much block gas limit is allowed to change between blocks (next limit must be within (gasLimit - gasLimit/divisor, gasLimit + gasLimit/divisor)). AFAIR this value is mandatory, setting it to some large number would cause block gas limit to stay constant.

The fix doesn't accept such transactions at all, so after you upgrade your nodes to a patched Parity versions those transactions will be discarded.

--gas-floor-target suggestion was a workaround to process those transactions (or reject them completely) by driving the block gas limit up or down respectively - not all nodes need to have the same values, some of them might be trying to push the limit up while some keep it low and it will fluctuate.

bjornwgnr commented 6 years ago

@phahulin @rstormsf: Can this issue be closed?