My proposal: Set a minimum value of at least 1 wei to MINFEE
, PARENT_MINFEE
, and block.gas_used
.
delta = block.gas_used - TARGET_GASUSED
TARGET_GASUSED = 8,000,000
MINFEE_MAX_CHANGE_DENOMINATOR = 8
There is also way to simplify the MINFEE
formula:
MINFEE = PARENT_MINFEE + PARENT_MINFEE * delta // TARGET_GASUSED // MINFEE_MAX_CHANGE_DENOMINATOR
For the rest of this comment, I will be using abbreviated variable names:
MF = MINFEE
MF_P = PARENT_MINFEE
MF_MCD = MINFEE_MAX_CHANGE_DENOMINATOR
GU_B = block.gas_used
GU_T = TARGET_GASUSED
delta = GU_B - GU_T
Note: I’m also using /
for division instead of //
- Substitute original formula with new variable names
MF = MF_P + MF_P * delta / GU_T / MF_MCD
- Separate
MF_P
MF = MF_P * (1 + delta / GU_T / MF_MCD)
- Instead of dividing by
MF_MCD
, multiply by the reciprocal
MF = MF_P * (1 + (delta / GU_T) * (1 / MF_MCD))
- Substitute in the variables for
delta
MF = MF_P * (1 + ((GU_B - GU_T) / GU_T) * (1 / MF_MCD))
- Separate the delta variables from the numerator and divide both delta variables
by the same denominator
MF = MF_P * (1 + ((GU_B / GU_T) - (GU_T / GU_T)) * (1 / MF_MCD))
-
GU_T / GU_T
== 1, so replaceGU_T / GU_T
with1
MF = MF_P * (1 + ((GU_B / GU_T) - 1) * (1 / MF_MCD))
- Multiply
1 / MF_MCD
with bothGU_B / GU_T
and-1
MF = MF_P * (1 + (GU_B / (GU_T * MF_MCD)) - (1 / MF_MCD))
- Replace the first
1
withMF_MCD / MF_MCD
MF = MF_P * ((MF_MCD / MF_MCD) + (GU_B / (GU_T * MF_MCD)) - (1 / MF_MCD))
- Since
MF_MCD / MF_MCD
and1 / MF_MCD
have the same denominator, we can combine the numerators
MF = MF_P * (((MF_MCD - 1) / MF_MCD) + (GU_B / (GU_T * MF_MCD)))
- Replace
MF_MCD
andGU_T
with their static values
MF = MF_P * (((8 - 1) / 8) + (GU_B / (8,000,000 * 8)))
- Simplify
MF = MF_P * (7 / 8) * (GU_B / 64,000,000)
MF = MF_P * ((7 * GU_B) / 512,000,000)
or
MF = MF_P * ((7 * GU_B) / (2^9 * 10^6))
My conclusion:
-
MINFEE
,PARENT_MINFEE
, andblock.gas_used
can never be equal to 0. - If
MINFEE
,PARENT_MINFEE
, orblock.gas_used
equal 0, all three variables
will equal 0.
Additional question:
- Can a bad actor to intentionally mine a block with 0 gas used?