Skip to content

Commit 8556d4a

Browse files
authored
Merge pull request #1977 from carver/berlin-core-tests
Enable more generic tests against Berlin
2 parents b663aca + ab9349a commit 8556d4a

File tree

12 files changed

+531
-15
lines changed

12 files changed

+531
-15
lines changed

eth/chains/mainnet/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from .constants import (
1414
MAINNET_CHAIN_ID,
15+
BERLIN_MAINNET_BLOCK,
1516
BYZANTIUM_MAINNET_BLOCK,
1617
PETERSBURG_MAINNET_BLOCK,
1718
ISTANBUL_MAINNET_BLOCK,
@@ -33,6 +34,7 @@
3334
)
3435
from eth.rlp.headers import BlockHeader
3536
from eth.vm.forks import (
37+
BerlinVM,
3638
ByzantiumVM,
3739
FrontierVM,
3840
HomesteadVM,
@@ -94,6 +96,7 @@ class MainnetHomesteadVM(MainnetDAOValidatorVM):
9496
PETERSBURG_MAINNET_BLOCK,
9597
ISTANBUL_MAINNET_BLOCK,
9698
MUIR_GLACIER_MAINNET_BLOCK,
99+
BERLIN_MAINNET_BLOCK,
97100
)
98101
MAINNET_VMS = (
99102
FrontierVM,
@@ -104,6 +107,7 @@ class MainnetHomesteadVM(MainnetDAOValidatorVM):
104107
PetersburgVM,
105108
IstanbulVM,
106109
MuirGlacierVM,
110+
BerlinVM,
107111
)
108112

109113
MAINNET_VM_CONFIGURATION = tuple(zip(MAINNET_FORK_BLOCKS, MAINNET_VMS))

eth/chains/mainnet/constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@
5252
# Muir Glacier Block
5353
#
5454
MUIR_GLACIER_MAINNET_BLOCK = BlockNumber(9200000)
55+
56+
#
57+
# Berlin Block
58+
#
59+
BERLIN_MAINNET_BLOCK = BlockNumber(12244000)

eth/tools/builder/chain/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
petersburg_at,
2727
istanbul_at,
2828
muir_glacier_at,
29+
berlin_at,
2930
latest_mainnet_at,
3031
)
3132

eth/tools/builder/chain/builders.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
PetersburgVM,
7373
IstanbulVM,
7474
MuirGlacierVM,
75+
BerlinVM,
7576
)
7677

7778

@@ -235,6 +236,7 @@ def dao_fork_at(dao_fork_block_number: BlockNumber,
235236
petersburg_at = fork_at(PetersburgVM)
236237
istanbul_at = fork_at(IstanbulVM)
237238
muir_glacier_at = fork_at(MuirGlacierVM)
239+
berlin_at = fork_at(BerlinVM)
238240

239241
latest_mainnet_at = muir_glacier_at
240242

newsfragments/1977.internal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make sure Berlin is tested across all core tests. (also patched in some missing Muir Glacier ones)

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
ConstantinopleVM,
3232
PetersburgVM,
3333
IstanbulVM,
34+
MuirGlacierVM,
35+
BerlinVM,
3436
)
3537

3638
#
@@ -89,6 +91,8 @@ def _file_logging(request):
8991
ConstantinopleVM,
9092
PetersburgVM,
9193
IstanbulVM,
94+
MuirGlacierVM,
95+
BerlinVM,
9296
])
9397
def VM(request):
9498
return request.param

tests/core/builder-tools/test_chain_construction.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from eth.chains.base import MiningChain
66
from eth.consensus.pow import check_pow
77
from eth.tools.builder.chain import (
8+
berlin_at,
89
build,
910
byzantium_at,
1011
chain_id,
@@ -33,6 +34,7 @@
3334
PetersburgVM,
3435
IstanbulVM,
3536
MuirGlacierVM,
37+
BerlinVM,
3638
)
3739

3840

@@ -85,6 +87,7 @@ def test_chain_builder_construct_chain_vm_configuration_multiple_forks():
8587
(petersburg_at, PetersburgVM),
8688
(istanbul_at, IstanbulVM),
8789
(muir_glacier_at, MuirGlacierVM),
90+
(berlin_at, BerlinVM),
8891
(latest_mainnet_at, MuirGlacierVM), # this will change whenever the next upgrade is locked
8992
)
9093
)

tests/core/chain-object/test_contract_call.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
ConstantinopleVM,
2828
PetersburgVM,
2929
IstanbulVM,
30+
MuirGlacierVM,
31+
BerlinVM,
3032
)
3133

3234

@@ -223,6 +225,26 @@ def test_get_transaction_result(
223225
'useLotsOfGas()',
224226
OutOfGas,
225227
),
228+
(
229+
MuirGlacierVM,
230+
'doRevert()',
231+
Revert,
232+
),
233+
(
234+
MuirGlacierVM,
235+
'useLotsOfGas()',
236+
OutOfGas,
237+
),
238+
(
239+
BerlinVM,
240+
'doRevert()',
241+
Revert,
242+
),
243+
(
244+
BerlinVM,
245+
'useLotsOfGas()',
246+
OutOfGas,
247+
),
226248
),
227249
)
228250
def test_get_transaction_result_revert(

tests/core/chain-object/test_gas_estimation.py

Lines changed: 148 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
ConstantinopleVM,
1414
PetersburgVM,
1515
IstanbulVM,
16+
MuirGlacierVM,
17+
BerlinVM,
1618
)
1719
from eth._utils.address import force_bytes_to_address
1820

@@ -608,6 +610,150 @@
608610
22272,
609611
id='sha3 precompile 32 bytes 1000_tolerance binary pending for IstanbulVM',
610612
),
613+
pytest.param(
614+
b'',
615+
None,
616+
ADDR_1010,
617+
True,
618+
MuirGlacierVM,
619+
21000,
620+
id='simple default pending for MuirGlacierVM',
621+
),
622+
pytest.param(
623+
b'',
624+
None,
625+
ADDR_1010,
626+
False,
627+
MuirGlacierVM,
628+
21000,
629+
id='simple default for MuirGlacierVM',
630+
),
631+
pytest.param(
632+
b'\xff' * 10,
633+
None,
634+
ADDR_1010,
635+
True,
636+
MuirGlacierVM,
637+
21160,
638+
id='10 bytes default pending for MuirGlacierVM',
639+
),
640+
pytest.param(
641+
b'\xff' * 10,
642+
None,
643+
ADDR_1010,
644+
False,
645+
MuirGlacierVM,
646+
21160,
647+
id='10 bytes default for MuirGlacierVM',
648+
),
649+
pytest.param(
650+
b'\xff' * 32,
651+
None,
652+
ADDRESS_2,
653+
True,
654+
MuirGlacierVM,
655+
33675,
656+
id='sha3 precompile 32 bytes default pending for MuirGlacierVM',
657+
),
658+
pytest.param(
659+
b'\xff' * 32,
660+
None,
661+
ADDRESS_2,
662+
False,
663+
MuirGlacierVM,
664+
33687,
665+
id='sha3 precompile 32 bytes default for MuirGlacierVM',
666+
),
667+
pytest.param(
668+
b'\xff' * 320,
669+
None,
670+
ADDRESS_2,
671+
True,
672+
MuirGlacierVM,
673+
38265,
674+
id='sha3 precompile 320 bytes default pending for MuirGlacierVM',
675+
),
676+
pytest.param(
677+
b'\xff' * 32,
678+
binary_gas_search_1000_tolerance,
679+
ADDRESS_2,
680+
True,
681+
MuirGlacierVM,
682+
22272,
683+
id='sha3 precompile 32 bytes 1000_tolerance binary pending for MuirGlacierVM',
684+
),
685+
pytest.param(
686+
b'',
687+
None,
688+
ADDR_1010,
689+
True,
690+
BerlinVM,
691+
21000,
692+
id='simple default pending for BerlinVM',
693+
),
694+
pytest.param(
695+
b'',
696+
None,
697+
ADDR_1010,
698+
False,
699+
BerlinVM,
700+
21000,
701+
id='simple default for BerlinVM',
702+
),
703+
pytest.param(
704+
b'\xff' * 10,
705+
None,
706+
ADDR_1010,
707+
True,
708+
BerlinVM,
709+
21160,
710+
id='10 bytes default pending for BerlinVM',
711+
),
712+
pytest.param(
713+
b'\xff' * 10,
714+
None,
715+
ADDR_1010,
716+
False,
717+
BerlinVM,
718+
21160,
719+
id='10 bytes default for BerlinVM',
720+
),
721+
pytest.param(
722+
b'\xff' * 32,
723+
None,
724+
ADDRESS_2,
725+
True,
726+
BerlinVM,
727+
33675,
728+
id='sha3 precompile 32 bytes default pending for BerlinVM',
729+
),
730+
pytest.param(
731+
b'\xff' * 32,
732+
None,
733+
ADDRESS_2,
734+
False,
735+
BerlinVM,
736+
33687,
737+
id='sha3 precompile 32 bytes default for BerlinVM',
738+
),
739+
pytest.param(
740+
b'\xff' * 320,
741+
None,
742+
ADDRESS_2,
743+
True,
744+
BerlinVM,
745+
38265,
746+
id='sha3 precompile 320 bytes default pending for BerlinVM',
747+
),
748+
pytest.param(
749+
b'\xff' * 32,
750+
binary_gas_search_1000_tolerance,
751+
ADDRESS_2,
752+
True,
753+
BerlinVM,
754+
22272,
755+
id='sha3 precompile 32 bytes 1000_tolerance binary pending for BerlinVM',
756+
),
611757
),
612758
)
613759
def test_estimate_gas(
@@ -667,7 +813,8 @@ def test_estimate_gas(
667813
(ConstantinopleVM, 722760),
668814
(PetersburgVM, 722760),
669815
(IstanbulVM, 186120),
670-
816+
(MuirGlacierVM, 186120),
817+
(BerlinVM, 186120),
671818
)
672819
)
673820
def test_estimate_gas_on_full_block(

0 commit comments

Comments
 (0)