Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 2.52 KB

tip-397.md

File metadata and controls

66 lines (45 loc) · 2.52 KB
tip: 397
title: Raise limit of the 13th network parameter	
author: [email protected]
discussions to: https://github.com/tronprotocol/TIPs/issues/384
status: Final
type: Standards Track
category: VM
created: 2022-04-06

Abstract

Raise the limit of the 13th(MAX_CPU_TIME_OF_ONE_TX) network parameter.

Motivation

The 13th network parameter now ranges from 10 to 100 ms. This range currently greatly limits developers from designing more diverse and complex applications such as DeFi, GameFi, etc.

Therefore the purpose of this TIP is to extend the limit of the range of the 13th network parameter.

Specifications

After the ALLOW_HIGHER_LIMIT_FOR_MAX_CPU_TIME_OF_ONE_TX takes effect, the limit for the 13th network parameter will change from 100 ms to 400 ms.

Rationale

The time range for SR to produce blocks

TRON network generates block every 3 seconds. According to the design of the TRON's DPOS consensus mechanism, the time range for SR to produce blocks is 450 to 1500 ms.

The timeout calculation algorithm is shown in the following code which link is at DposTask.java.

    ...
    long timeout =
        pTime + BLOCK_PRODUCED_INTERVAL / 2 * dposService.getBlockProduceTimeoutPercent() / 100;
    ...

The range of getBlockProduceTimeoutPercent() is set in the following code which link is at Args.java.

    ...
    if (PARAMETER.blockProducedTimeOut < 30) {
      PARAMETER.blockProducedTimeOut = 30;
    }
    if (PARAMETER.blockProducedTimeOut > 100) {
      PARAMETER.blockProducedTimeOut = 100;
    }
    ...

Therefore the time range for SR to produce blocks can be calculated by 3000 / 2 * 30 / 100 ~ 3000 / 2 * 100 / 100 = 450 ~ 1500

Why the limit cannot exceed 450ms

According to the above analysis, SR can set its own block production time to a minimum of 450ms. Then assuming that the 13th network parameter is set to a value greater than 450ms, it means that the SR cannot package any other system contract transaction after it packages a smart contract transaction that exceeds 450ms.

Backwards Compatibility

This is a breaking change given proposal to set the 13th network parameter to a new value greater than 100 will be legal. So need a hard fork to achieve.

Security Considerations

There are no known security considerations issues.