Skip to content

Commit

Permalink
Update EIP-7783: Add stepwise linear strategy
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
Inspector-Butters authored Feb 20, 2025
1 parent 07126ad commit 14e0fc6
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion EIPS/eip-7783.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The EIP proposes the introduction of a new gas limit management mechanism that a

## **Specification**

There are different approaches to implement a controlled gas limit increase strategy. The following are two possible strategies that can be used:
There are different approaches to implement a controlled gas limit increase strategy. The following are three possible strategies that can be used:

### **Linear Gas Limit Increase Strategy**

Expand All @@ -62,6 +62,35 @@ Where:
If we set `blockNumStart` to the current block number, `initialGasLimit` to the current gas limit (`30_000_000`), `r` to 6, and `gasLimitCap` to `60_000_000`, the gas limit will increase by 6 gas per block for two years, reaching 30 million gas at the end of a $\approx$ 2 years period.
The result of `compute_gas_limit` will be the gas limit aimed by the proposer for the block `blockNum`. none of this is enforced at the protocol level, and the proposer needs to still follow protocol rules related to the gas limit.

### **Stepwise Linear Gas Limit Increase Strategy**

Add a new "Gas Limit" selection strategy that takes in Block Number `N` and spits out the Gas Limit `GL` for that block. The strategy is as follows:

- The gas limit `GL_t` at block `t` is calculated as:

```python
def compute_gas_limit(blockNum: int, blockNumStart: int, r: int, step_blocks_interval: int, gasLimitCap: int) -> int:
if blockNum < blockNumStart:
return initialGasLimit
else:
return min(gasLimitCap, initialGasLimit + r * ((blockNum - blockNumStart) // step_blocks_interval))
```

Where:

- `blockNum` is the block number for which the gas limit is being calculated.
- `blockNumStart` is the block number at which the gas limit increase starts.
- `initialGasLimit` is the initial gas limit at block `blockNumStart`.
- `step_blocks_interval` is the number of blocks after which the gas limit increases (cooldown period).
- `r` is the rate at which the gas limit increases per step.
- `gasLimitCap` is the maximum gas limit that can be reached.

This strategy has three main advantages:

- It provides larger, more visible, and distinct metric changes over each step.
- It allows for collection of more stabilized metrics over the length of the cooldown period.
- It gives the community more time to evaluate the impact of the gas limit increase and act accordingly.

### **Exponential Gas Limit Increase Strategy**

Add a new "Gas Limit" selection strategy that takes in Block Number `N` and spits out the Gas Limit `GL` for that block. The strategy is as follows:
Expand Down

0 comments on commit 14e0fc6

Please sign in to comment.