File tree Expand file tree Collapse file tree 15 files changed +264
-7
lines changed Expand file tree Collapse file tree 15 files changed +264
-7
lines changed Original file line number Diff line number Diff line change 1
1
Release notes
2
2
=============
3
3
4
+ Unreleased (latest source)
5
+ --------------------------
6
+
7
+ - `#1719 <https://github.com/ethereum/py-evm/pull/1719 >`_: Implement and activate Petersburg fork (aka Constantinople fixed)
8
+
9
+
4
10
0.2.0-alpha.40
5
11
--------------
6
12
Original file line number Diff line number Diff line change 13
13
from .constants import (
14
14
MAINNET_CHAIN_ID ,
15
15
BYZANTIUM_MAINNET_BLOCK ,
16
- CONSTANTINOPLE_MAINNET_BLOCK ,
16
+ PETERSBURG_MAINNET_BLOCK ,
17
17
TANGERINE_WHISTLE_MAINNET_BLOCK ,
18
18
HOMESTEAD_MAINNET_BLOCK ,
19
19
SPURIOUS_DRAGON_MAINNET_BLOCK ,
29
29
from eth .vm .base import BaseVM # noqa: F401
30
30
from eth .vm .forks import (
31
31
ByzantiumVM ,
32
- ConstantinopleVM ,
33
32
FrontierVM ,
34
33
HomesteadVM ,
34
+ PetersburgVM ,
35
35
SpuriousDragonVM ,
36
36
TangerineWhistleVM ,
37
37
)
@@ -80,15 +80,15 @@ class MainnetHomesteadVM(MainnetDAOValidatorVM):
80
80
TANGERINE_WHISTLE_MAINNET_BLOCK ,
81
81
SPURIOUS_DRAGON_MAINNET_BLOCK ,
82
82
BYZANTIUM_MAINNET_BLOCK ,
83
- CONSTANTINOPLE_MAINNET_BLOCK ,
83
+ PETERSBURG_MAINNET_BLOCK ,
84
84
)
85
85
MAINNET_VMS = (
86
86
FrontierVM ,
87
87
MainnetHomesteadVM ,
88
88
TangerineWhistleVM ,
89
89
SpuriousDragonVM ,
90
90
ByzantiumVM ,
91
- ConstantinopleVM ,
91
+ PetersburgVM ,
92
92
)
93
93
94
94
MAINNET_VM_CONFIGURATION = tuple (zip (MAINNET_FORK_BLOCKS , MAINNET_VMS ))
Original file line number Diff line number Diff line change 39
39
BYZANTIUM_MAINNET_BLOCK = BlockNumber (4370000 )
40
40
41
41
#
42
- # Constantinople Block
42
+ # Petersburg Block
43
43
#
44
- CONSTANTINOPLE_MAINNET_BLOCK = BlockNumber (9876543210 )
44
+ PETERSBURG_MAINNET_BLOCK = BlockNumber (7280000 )
Original file line number Diff line number Diff line change 4
4
from .constants import (
5
5
BYZANTIUM_ROPSTEN_BLOCK ,
6
6
CONSTANTINOPLE_ROPSTEN_BLOCK ,
7
+ PETERSBURG_ROPSTEN_BLOCK ,
7
8
ROPSTEN_CHAIN_ID ,
8
9
SPURIOUS_DRAGON_ROPSTEN_BLOCK ,
9
10
TANGERINE_WHISTLE_ROPSTEN_BLOCK ,
16
17
from eth .vm .forks import (
17
18
ByzantiumVM ,
18
19
ConstantinopleVM ,
20
+ PetersburgVM ,
19
21
SpuriousDragonVM ,
20
22
TangerineWhistleVM ,
21
23
)
27
29
(SPURIOUS_DRAGON_ROPSTEN_BLOCK , SpuriousDragonVM ),
28
30
(BYZANTIUM_ROPSTEN_BLOCK , ByzantiumVM ),
29
31
(CONSTANTINOPLE_ROPSTEN_BLOCK , ConstantinopleVM ),
32
+ (PETERSBURG_ROPSTEN_BLOCK , PetersburgVM ),
30
33
)
31
34
32
35
Original file line number Diff line number Diff line change 40
40
# Constantinople
41
41
#
42
42
CONSTANTINOPLE_ROPSTEN_BLOCK = BlockNumber (4230000 )
43
+
44
+
45
+ #
46
+ # Petersburg
47
+ #
48
+ PETERSBURG_ROPSTEN_BLOCK = BlockNumber (4939394 )
Original file line number Diff line number Diff line change 16
16
from .constantinople import ( # noqa: F401
17
17
ConstantinopleVM ,
18
18
)
19
+ from .petersburg import ( # noqa: F401
20
+ PetersburgVM ,
21
+ )
Original file line number Diff line number Diff line change
1
+ from typing import ( # noqa: F401
2
+ Type ,
3
+ )
4
+
5
+ from eth .rlp .blocks import BaseBlock # noqa: F401
6
+ from eth .vm .forks .byzantium import (
7
+ ByzantiumVM ,
8
+ get_uncle_reward ,
9
+ )
10
+ from eth .vm .state import BaseState # noqa: F401
11
+
12
+ from .blocks import PetersburgBlock
13
+ from .constants import EIP1234_BLOCK_REWARD
14
+ from .headers import (
15
+ compute_petersburg_difficulty ,
16
+ configure_petersburg_header ,
17
+ create_petersburg_header_from_parent ,
18
+ )
19
+ from .state import PetersburgState
20
+
21
+
22
+ class PetersburgVM (ByzantiumVM ):
23
+ # fork name
24
+ fork = 'petersburg'
25
+
26
+ # classes
27
+ block_class = PetersburgBlock # type: Type[BaseBlock]
28
+ _state_class = PetersburgState # type: Type[BaseState]
29
+
30
+ # Methods
31
+ create_header_from_parent = staticmethod (create_petersburg_header_from_parent ) # type: ignore # noqa: E501
32
+ compute_difficulty = staticmethod (compute_petersburg_difficulty ) # type: ignore
33
+ configure_header = configure_petersburg_header
34
+ get_uncle_reward = staticmethod (get_uncle_reward (EIP1234_BLOCK_REWARD ))
35
+
36
+ @staticmethod
37
+ def get_block_reward () -> int :
38
+ return EIP1234_BLOCK_REWARD
Original file line number Diff line number Diff line change
1
+ from rlp .sedes import (
2
+ CountableList ,
3
+ )
4
+ from eth .rlp .headers import (
5
+ BlockHeader ,
6
+ )
7
+ from eth .vm .forks .byzantium .blocks import (
8
+ ByzantiumBlock ,
9
+ )
10
+
11
+ from .transactions import (
12
+ PetersburgTransaction ,
13
+ )
14
+
15
+
16
+ class PetersburgBlock (ByzantiumBlock ):
17
+ transaction_class = PetersburgTransaction
18
+ fields = [
19
+ ('header' , BlockHeader ),
20
+ ('transactions' , CountableList (transaction_class )),
21
+ ('uncles' , CountableList (BlockHeader ))
22
+ ]
Original file line number Diff line number Diff line change
1
+ from eth_utils .toolz import (
2
+ merge ,
3
+ )
4
+
5
+ from eth .vm .forks .byzantium .computation import (
6
+ BYZANTIUM_PRECOMPILES
7
+ )
8
+ from eth .vm .forks .byzantium .computation import (
9
+ ByzantiumComputation
10
+ )
11
+
12
+ from .opcodes import PETERSBURG_OPCODES
13
+
14
+ PETERSBURG_PRECOMPILES = merge (
15
+ BYZANTIUM_PRECOMPILES ,
16
+ {
17
+ # TODO: add new precompiles
18
+ },
19
+ )
20
+
21
+
22
+ class PetersburgComputation (ByzantiumComputation ):
23
+ """
24
+ A class for all execution computations in the ``Petersburg`` fork.
25
+ Inherits from :class:`~eth.vm.forks.byzantium.computation.ByzantiumComputation`
26
+ """
27
+ # Override
28
+ opcodes = PETERSBURG_OPCODES
29
+ _precompiles = PETERSBURG_PRECOMPILES
Original file line number Diff line number Diff line change
1
+ from eth_utils import denoms
2
+
3
+
4
+ GAS_EXTCODEHASH_EIP1052 = 400
5
+
6
+ EIP1234_BLOCK_REWARD = 2 * denoms .ether
You can’t perform that action at this time.
0 commit comments