ethereum / execution-specs

Specification for the Execution Layer. Tracking network upgrades.
Creative Commons Zero v1.0 Universal
870 stars 240 forks source link

Remove spurious differences between hardforks #604

Open petertdavies opened 2 years ago

petertdavies commented 2 years ago

Currently there are a number of spurious differences between forks. This means that tools like diff can't be used to their full potential.

For example the only difference between Istanbul and Muir Glacier should be the value of BOMB_DELAY_BLOCKS and MAINNET_FORK_BLOCK. The actual diff is:

diff -u src/ethereum/istanbul/__init__.py src/ethereum/muir_glacier/__init__.py
--- src/ethereum/istanbul/__init__.py   2022-07-11 13:51:15.223853555 +0100
+++ src/ethereum/muir_glacier/__init__.py   2022-07-11 13:51:15.223853555 +0100
@@ -1,8 +1,8 @@
 """
-Ethereum Istanbul Hardfork
-^^^^^^^^^^^^^^^^^^^^^^^^^^
+Ethereum Muir Glacier Hardfork
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-The Eighth Ethereum hardfork.
+The Ninth Ethereum hardfork.
 """

-MAINNET_FORK_BLOCK = 9069000
+MAINNET_FORK_BLOCK = 9200000
Common subdirectories: src/ethereum/istanbul/__pycache__ and src/ethereum/muir_glacier/__pycache__
diff -u src/ethereum/istanbul/spec.py src/ethereum/muir_glacier/spec.py
--- src/ethereum/istanbul/spec.py   2022-09-13 16:13:25.178809923 +0100
+++ src/ethereum/muir_glacier/spec.py   2022-09-13 16:13:25.178809923 +0100
@@ -61,7 +61,7 @@
 GAS_LIMIT_MINIMUM = 5000
 GENESIS_DIFFICULTY = Uint(131072)
 MAX_OMMER_DEPTH = 6
-BOMB_DELAY_BLOCKS = 5000000
+BOMB_DELAY_BLOCKS = 9000000
 EMPTY_OMMER_HASH = keccak256(rlp.encode([]))

diff -u src/ethereum/istanbul/spec.py.rej src/ethereum/muir_glacier/spec.py.rej
--- src/ethereum/istanbul/spec.py.rej   2022-09-12 14:43:20.633086763 +0100
+++ src/ethereum/muir_glacier/spec.py.rej   2022-09-12 14:43:20.633086763 +0100
@@ -1,5 +1,5 @@
---- src/ethereum/istanbul/spec.py
-+++ src/ethereum/istanbul/spec.py
+--- src/ethereum/muir_glacier/spec.py
++++ src/ethereum/muir_glacier/spec.py
 @@ -877,15 +877,11 @@ def calculate_block_difficulty(
      # bomb has no effect prior to block 200000 we pretend it existed from
      # genesis.
diff -u src/ethereum/istanbul/trie.py src/ethereum/muir_glacier/trie.py
--- src/ethereum/istanbul/trie.py   2022-07-11 13:51:15.223853555 +0100
+++ src/ethereum/muir_glacier/trie.py   2022-07-11 13:51:15.223853555 +0100
@@ -29,8 +29,8 @@
     cast,
 )

-from ethereum.constantinople import trie as previous_trie
 from ethereum.crypto.hash import keccak256
+from ethereum.istanbul import trie as previous_trie
 from ethereum.utils.ensure import ensure
 from ethereum.utils.hexadecimal import hex_to_bytes

Common subdirectories: src/ethereum/istanbul/utils and src/ethereum/muir_glacier/utils
Common subdirectories: src/ethereum/istanbul/vm and src/ethereum/muir_glacier/vm
SamWilsn commented 1 week ago

This has improved since this was first opened, but there are still some spurious differences:

diff '--color=auto' -U0 -r src/ethereum/istanbul/utils/address.py src/ethereum/muir_glacier/utils/address.py
--- src/ethereum/istanbul/utils/address.py      2024-11-12 10:32:05.622539227 -0500
+++ src/ethereum/muir_glacier/utils/address.py  2024-11-12 10:32:05.695871742 -0500
@@ -12 +12 @@
-Address specific functions used in this istanbul version of
+Address specific functions used in this muir_glacier version of
@@ -85 +85 @@
-    address: `ethereum.istanbul.fork_types.Address`
+    address: `ethereum.muir_glacier.fork_types.Address`
diff '--color=auto' -U0 -r src/ethereum/istanbul/utils/hexadecimal.py src/ethereum/muir_glacier/utils/hexadecimal.py
--- src/ethereum/istanbul/utils/hexadecimal.py  2024-11-12 10:31:43.646116322 -0500
+++ src/ethereum/muir_glacier/utils/hexadecimal.py      2024-11-12 10:31:43.782781479 -0500
@@ -13 +13 @@
-Istanbul types.
+Muir Glacier types.
diff '--color=auto' -U0 -r src/ethereum/istanbul/utils/message.py src/ethereum/muir_glacier/utils/message.py
--- src/ethereum/istanbul/utils/message.py      2024-11-12 10:31:43.649449619 -0500
+++ src/ethereum/muir_glacier/utils/message.py  2024-11-12 10:31:43.786114776 -0500
@@ -12 +12 @@
-Message specific functions used in this istanbul version of
+Message specific functions used in this muir_glacier version of
@@ -66 +66 @@
-    message: `ethereum.istanbul.vm.Message`
+    message: `ethereum.muir_glacier.vm.Message`
diff '--color=auto' -U0 -r src/ethereum/istanbul/vm/interpreter.py src/ethereum/muir_glacier/vm/interpreter.py
--- src/ethereum/istanbul/vm/interpreter.py     2024-11-12 10:31:43.676115991 -0500
+++ src/ethereum/muir_glacier/vm/interpreter.py 2024-11-12 10:31:43.819447741 -0500
@@ -162 +162 @@
-    evm: :py:class:`~ethereum.istanbul.vm.Evm`
+    evm: :py:class:`~ethereum.muir_glacier.vm.Evm`
@@ -217 +217 @@
-    evm: :py:class:`~ethereum.istanbul.vm.Evm`
+    evm: :py:class:`~ethereum.muir_glacier.vm.Evm`