The chain-wide minimum gas price is a consensus parameter, which is the lower bound of the minimum gas prices set by different validators. This consensus parameter is modified by the validators.
After the XHedge upgrade, validators (or their corresponding rewardTo account) can send transactions to the staking contract (address: 0x2710) to anticipant the decision of minimum gas price.
The staking contract is a system contract implemented natively using golang, instead of solidity. However, we provide a pseudo-code at the end of this document to show how the logic of gas price decisions, hoping it can help your understanding.
The logic of gas price decisions
There are two hard-coded constants: the upper bound and lower bound of the minimum gas price. The decided minimum gas price cannot exceed these bounds.
The minimum gas price is decided in a voting process:
A validator starts a voting process by calling proposal. This function's argument is the target minimum gas price this validator votes for.
The other validators call vote to specify the target minimum gas price of each one.
The voting process will last for 24 hours. When it ends, anyone can call executeProposal to make the decision effective.
The decided minimum gas price is the middle of the arithmetic mean value and the geometric mean value of all the voted targets.