tip: 276
title: Optimize block verification logic
author: [email protected]
discussions to: https://github.com/tronprotocol/TIPs/issues/276
status: Final
category: Core
created: 2021-06-03
This TIP is to optimize the block verification logic to reduce block processing time.
According to statistics, the verification of each transaction takes about 3ms on average. After analysis, the verification of the transaction takes up nearly one-third of the time during the entire block processing. This article details the optimization of the block verification.
In order to improve the performance of the blockchain, increase the TPS, and reduce the block loss rate, it is necessary to reduce the block processing time.
TODO
After testing and analysis, most of the transactions packaged in the block are also in the pending queue, and the transactions in the pending queue are successfully verified. So whether it can be considered, if the transaction in the block also exists in the pending queue, it is not necessary to verify the signature. Of course, there is a special case that needs to be considered. In the scenario of a AccountUpdateContract
transaction, the AccountUpdateContract
transaction will change the account permissions, so the final logic can be implemented as follows:
- Extract the account list corresponding to the
AccountUpdateContract
transaction in the pending queue - If the transaction in the block also exists in the pending queue, and the corresponding account is not in the list of multiple signature accounts, you can skip the verification
- Verify transaction signatures that have not skipped verification