Skip to content

Commit

Permalink
Increased block weight to 8 Trillions (300 Millions gas) (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielMartinezRodriguez authored Oct 6, 2023
1 parent 5525b5f commit 6fd3d5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ Using this value and estimating the share of the block time that is spent in com

- **COMPUTATION_BLOCK_TIME_RATIO**: How much part of the block time could be spent in processing transactions.
- **MAXIMUM_BLOCK_WEIGHT**: The maximum weight that could be processed given the block time and `COMPUTATION_BLOCK_TIME_RATIO`
- MAXIMUM_NORMAL_BLOCK_WEIGHT = 1_333_333_333_333
- **Block Gas Limit**: ~50_000_000. Frontier assumes that a Gas Unit is equals to 20_000 Weight (`WEIGHT_PER_GAS`), and the blocks would allow till 75% (`NORMAL_DISPATCH_RATIO`) of `Normal` extrinsics in each one. The formula looks like:
- MAXIMUM_NORMAL_BLOCK_WEIGHT = 8_000_000_000_000
- **Block Gas Limit**: ~300_000_000. Frontier assumes that a Gas Unit is equals to 20_000 Weight (`WEIGHT_PER_GAS`), and the blocks would allow till 75% (`NORMAL_DISPATCH_RATIO`) of `Normal` extrinsics in each one. The formula looks like:

```
Gas Limit = NORMAL_DISPATCH_RATIO * MBW / WEIGHT_PER_GAS
Gas Limit = 0.75 * 1_333_333_333_333 / 20_000 = 50_000_000
Gas Limit = 0.75 * 8_000_000_000_000 / 20_000 = 300_000_000
```

## Links
Expand Down
5 changes: 4 additions & 1 deletion runtime/src/stability_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// How much of time of block time is consumed (at most) in computing normal extrinsics
const COMPUTATION_BLOCK_TIME_RATIO: (u64, u64) = (2, 3); // 2 third parts of the block time

const COMPUTATION_POWER_MULTIPLIER: u64 = 6; // 6 times more computation power than normal

// how much weight for normal extrinsics could be processed in a block
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_MILLIS)
.mul(MILLISECS_PER_BLOCK)
.mul(COMPUTATION_POWER_MULTIPLIER)
.mul(COMPUTATION_BLOCK_TIME_RATIO.0)
.div(COMPUTATION_BLOCK_TIME_RATIO.1) // 1_333_333_333_333
.div(COMPUTATION_BLOCK_TIME_RATIO.1) // 8_000_000_000_000
.set_proof_size(u64::MAX);

// `.set_proof_size`, since migration to WeightV2, we have set the proof size weight for the maximum block.
Expand Down

0 comments on commit 6fd3d5d

Please sign in to comment.