Skip to content

Lower MaxBlockSystemFee limit #3552

@roman-khimov

Description

@roman-khimov

Summary or problem description
Our primary resource limiter on the network is GAS, all transactions are paid for and the presumption is that computational resources required to process transactions are proportional to the GAS cost of its system fee. We know sometimes this condition is not met and this opens possibilities for lowering the cost of DoS attacks (#2521, #2528, #2530, #2532, #2723, nspcc-dev/neo-go#3490, some others as well), but if we're to suppose #3510 is implemented and GAS cost follows the computational effort required better we still can have a MaxBlockSystemFee amount of GAS spent for execution in a block and it's not a low number.

The default right now is 1500 which is 10K of transactions like https://dora.coz.io/transaction/neo3/mainnet/0xbcd90d15b904c495294e99b954695be14d137d7c6d4c6fa8c0c2956a60f47f7b or 27K of transactions like https://dora.coz.io/transaction/neo3/mainnet/0xbcd90d15b904c495294e99b954695be14d137d7c6d4c6fa8c0c2956a60f47f7b. Of course there is also MaxTransactionsPerBlock, but it's not relevant in the context of this problem, we can pack less of more resource-demanding transactions into a block, they will ultimately be able to burn 1500 GAS overall. Considering proposals for lowering execution fee factor and other cost-related parameters overall computational effort can be quite huge for this 1500 GAS and it can delay subsequent blocks while ideally we want to have maximum processing time approximately equal to block time.

MaxBlockSystemFee can be lowered (even though unfortunately it's not a part of the Policy contract, see #2300), but we can't have it lower than NEO's RegisterPrice which currently is 1000 GAS and we have no intent to lower that (becoming a candidate should cost something real, see #2234). 1000 GAS is still quite a lot and can significant time to process, my estimate is that we probably want MaxBlockSystemFee to be in the lower hundreds range (100-400). But if we're to set MaxBlockSystemFee that low we won't be able to register candidates which just can't happen.

Do you have any solution you want to propose?
We can change registration mechanism from registerCandidate invocation to NEP-17 transfer of registration price to the NEO contract address. This will require NEO to implement NEP-27 handler and accept some GAS with additional pubkey passed in data, it can then burn this GAS immediately since it's not intended to hold it. But as the result of it we'll have some "normal" system fee value for registration transactions and MaxBlockSystemFee could be set lower than RegisterPrice.

Notice that it also solves the problem of registration transaction fee estimation since most RPC nodes are configured to 10-20 MaxGasInvoke and it's just impossible to make a proper invokefunction call for the registerCandidate method. Any software producing registration transactions currently has to perform some tricks like https://github.com/nspcc-dev/neo-go/blob/b8a65d3c37cfa429b8a5e135422bb1fa78762056/pkg/rpcclient/neo/neo.go#L327 to create a transaction.

This is a breaking change if we're to remove registerCandidate (but we can keep it for private networks and compatibility) or lower MaxBlockSystemFee to something less than RegisterPrice, but it's a rarely used method, so I doubt it's a big problem.

Where in the software does this update applies to?

  • NEO native contract
  • Consensus

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionInitial issue state - proposed but not yet accepted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions