neo-project / neo-node

MIT License
229 stars 223 forks source link

neo-cli: tune MaxTransactionsPerBlock for testnet #850

Closed roman-khimov closed 2 years ago

roman-khimov commented 2 years ago

Allow to flush the mempool in just 10 blocks.

Jim8y commented 2 years ago

Do we have an approximate maximum execution time of a single transction, just in case of Resource Exhaustion Attack?

roman-khimov commented 2 years ago

It's strongly correlated with GAS cost and we have MaxBlockSystemFee limit (somewhat optimistic I'd say, but still). We also know that C# node can handle several thousands of NEO transfers per second, so with 15s block time 5K doesn't seem to be a lot of transactions.

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 1803322398


Totals Coverage Status
Change from base Build 1582407624: 0.0%
Covered Lines: 107
Relevant Lines: 694

💛 - Coveralls
Jim8y commented 2 years ago

@roman-khimov I know the awesome benchmark u made on neo N3. Actually I always wanna know what exactly makes C# slower than go node. But anyway, benchmark won't stop resource exhaustion attack, strict gas restrictions may work, I will check it out.

roman-khimov commented 2 years ago

DoS scenarios are always limited by GAS, sending lots of transactions costs something and it's not hard to calculate the cost of the attack. Actually, this change raises the cost of the attack because to cause some noticeable delays one would need to send more transactions and spend more GAS.

As for computational overhead of big blocks, MaxBlockSystemFee is big enough already to be noticeable and if someone has enough GAS to spend he might keep the nodes somewhat busy even with a single transaction (just ask @vang1ong7ang). But then again, the attacker is limited by the amount of GAS (money) he has for attack.

Jim8y commented 2 years ago

I understand. You can keep working on this pr, I will do a thorough benchmark on opcodes in another work.

roman-khimov commented 2 years ago

I will do a thorough benchmark on opcodes in another work.

Take a look at neo-project/neo#1875 also, although both VMs have improved since then I think.

Jim8y commented 2 years ago

Take a look at neo-project/neo#1875

Thank you.

superboyiii commented 2 years ago

@roman-khimov Could you push it to develop branch? We'd like to keep master clear before next release.

roman-khimov commented 2 years ago

@roman-khimov Could you push it to develop branch?

Sure, done.