Why is there block gas limit? Should it just be the sum of gas limit used by each transactions inside the block? Why do we need an extra field for it instead of calculate it?
2 Answers
The gas limit of a block defines the maximum amount of gas that all the transactions inside the block are allowed to consume. Its purpose is to keep propagation and transaction time of the block at a minimum, thereby making the network decentralized. The gas limit of a block is not fixed, it can be adjusted by the miners by some factor. It also protects the nodes from attackers who could make an effective infinite transaction loop.
https://github.com/ethereum/wiki/wiki/Design-Rationale#gas-and-fees http://gavwood.com/Paper.pdf
On Ethereum, the number of pending transactions that can fit into the upcoming block depends on how many units of gas each transaction in the block might spend. When miners create new blocks, the total sum of the transaction gas limits in the block must be less than the block’s gas limit.
Since the London hard fork, each block has a target size of 15 million units of gas but the actual size of a block will vary depending on network demand. The maximum size of a block, or the block gas limit, is 30 million gas.
source :