From f0a3a23195b3279c081d10dd9dfbf0831166bdde Mon Sep 17 00:00:00 2001 From: lightclient <14004106+lightclient@users.noreply.github.com> Date: Sat, 8 May 2021 22:54:31 -0600 Subject: [PATCH] start with default base fee on fork block (#3556) --- EIPS/eip-1559.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/EIPS/eip-1559.md b/EIPS/eip-1559.md index 20058965..3abbb660 100644 --- a/EIPS/eip-1559.md +++ b/EIPS/eip-1559.md @@ -139,7 +139,7 @@ class Block: extra_data: bytes = bytes() proof_of_work: int = 0 nonce: int = 0 - base_fee_per_gas: int = 0 # default to 1,000,000,000 for blocks before INITIAL_FORK_BLOCK_NUMBER + base_fee_per_gas: int = 0 @dataclass class Account: @@ -149,6 +149,7 @@ class Account: storage_root: int = 0 code_hash: int = 0 +INITIAL_BASE_FEE = 1000000000 INITIAL_FORK_BLOCK_NUMBER = 10 # TBD BASE_FEE_MAX_CHANGE_DENOMINATOR = 8 ELASTICITY_MULTIPLIER = 2 @@ -157,7 +158,7 @@ class World(ABC): def validate_block(self, block: Block) -> None: parent_gas_target = self.parent(block).gas_limit // ELASTICITY_MULTIPLIER - # On the fork block, don't account for the ELASTICITY_MULTIPLIER to avoid + # on the fork block, don't account for the ELASTICITY_MULTIPLIER to avoid # unduly halving the gas target. if INITIAL_FORK_BLOCK_NUMBER == block.number: parent_gas_target = self.parent(block).gas_limit @@ -175,7 +176,9 @@ class World(ABC): assert gas_target >= parent_gas_target - parent_gas_target // 1024, 'invalid block: gas target decreased too much' # check if the base fee is correct - if parent_gas_used == parent_gas_target: + if INITIAL_FORK_BLOCK_NUMBER == block.number: + expected_base_fee_per_gas = INITIAL_BASE_FEE + elif parent_gas_used == parent_gas_target: expected_base_fee_per_gas = parent_base_fee_per_gas elif parent_gas_used > parent_gas_target: gas_used_delta = parent_gas_used - parent_gas_target