Skip to content

Commit d521ea2

Browse files
veoxpipermerriam
authored andcommitted
Update ethereum/tests fixtures (#1224)
* fixtures: update to db8ae9de91c303caad3eb9354015c07a0ec3adc3 Rolls forwards up to 2018-01-22. Passing of test_state_fixtures determined using `git bisect run`. * tests/test_state_fixtures(): bump fixtures and mark new test `xfail`. The upstream generated test is not sufficiently specific, and it's hard to determine which of the two implementations is incorrect. The principal author of the test case (Yoichi Hirai, github @pirapira) seems currently unavailable, so it's difficult for me to get specific details. * eth/precompiles/modexp: fix complexity calc (length^2, not 2^2). There was a typo in the "complexity" calculation function, a special interim value from EIP-198 used to determine total gas use. The code path was never previously exercised. NOTE: previous-commit "fixtures bump" was to commit: 9b1f07c58a70d1b17c4489c49eb9bebf4a27d290 Squashed commit: tests: update "very big number" in test_modexp_gas_fee_calculation(). ... and also fix that test's name, from "calculTation". The very-big-number is not actually in EIP-198; the latter has this to say: > it’s not possible to provide enough gas to make that computation. That's a bit cryptic, but the gist is that the most that can be represented in a 256-bit number is 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff which is 115792089237316195423570985008687907853269984665640564039457584007913129639935 and that's less than the 10684346944173007063723051170445283632835119638284563472873463025465780712173320789629146724657549280936306536701227228889744512638312451529980055895215896 required by this vector, or even the (erroneous) 708647586132375115992254428253169996062012306153720251921480414128428353393856280 that was in the test previously. * fixtures: update to 61185fe4b8762118fe9ee318539683b47cb04ed6 + mark RevertInCreateInInit as xfail. Rolls forwards up to 2018-03-01. Break in `RevertInCreateInInit.json` determined by `git bisect run`. The test is marked `xfail` to expicitly highlight the fact. This is done in 3 places - all are run as part of CI. * fixtures: update to f4faae91c5ba192c3fd9b8cf418c24e627786312 Determined state tests as "good" by `git bisect run`.
1 parent 971bc60 commit d521ea2

File tree

6 files changed

+52
-5
lines changed

6 files changed

+52
-5
lines changed

eth/precompiles/modexp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _compute_complexity(length):
3535
length ** 2 // 4 + 96 * length - 3072
3636
)
3737
else:
38-
return 2 ** 2 // 16 + 480 * length - 199680
38+
return length ** 2 // 16 + 480 * length - 199680
3939

4040

4141
def _extract_lengths(data):

fixtures

Submodule fixtures updated 14326 files

tests/core/vm/test_modexp_precompile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
(EIP198_VECTOR_A, 13056),
4242
(
4343
EIP198_VECTOR_C,
44-
708647586132375115992254428253169996062012306153720251921480414128428353393856280,
44+
10684346944173007063723051170445283632835119638284563472873463025465780712173320789629146724657549280936306536701227228889744512638312451529980055895215896, # noqa: E501
4545
),
4646
),
4747
)
48-
def test_modexp_gas_fee_calcultation(data, expected):
48+
def test_modexp_gas_fee_calculation(data, expected):
4949
actual = _compute_modexp_gas_fee(data)
5050
assert actual == expected
5151

tests/json-fixtures/test_blockchain.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,33 @@
3232
BASE_FIXTURE_PATH = os.path.join(ROOT_PROJECT_DIR, 'fixtures', 'BlockchainTests')
3333

3434

35+
# These are tests that are thought to be incorrect or buggy upstream,
36+
# at the commit currently checked out in submodule `fixtures`.
37+
# Ideally, this list should be empty.
38+
# WHEN ADDING ENTRIES, ALWAYS PROVIDE AN EXPLANATION!
39+
INCORRECT_UPSTREAM_TESTS = {
40+
# The test considers a "synthetic" scenario (the state described there can't
41+
# be arrived at using regular consensus rules).
42+
# * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418775512
43+
# The result is in conflict with the yellow-paper:
44+
# * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418800369
45+
('GeneralStateTests/stRevertTest/RevertInCreateInInit_d0g0v0.json', 'RevertInCreateInInit_d0g0v0_Byzantium'), # noqa: E501
46+
}
47+
48+
3549
def blockchain_fixture_mark_fn(fixture_path, fixture_name):
3650
if fixture_path.startswith('bcExploitTest'):
3751
return pytest.mark.skip("Exploit tests are slow")
3852
elif fixture_path == 'bcWalletTest/walletReorganizeOwners.json':
3953
return pytest.mark.skip("Wallet owner reorganization tests are slow")
54+
elif (fixture_path, fixture_name) in INCORRECT_UPSTREAM_TESTS:
55+
return pytest.mark.xfail(reason="Listed in INCORRECT_UPSTREAM_TESTS.")
4056

4157

4258
def blockchain_fixture_ignore_fn(fixture_path, fixture_name):
4359
if fixture_path.startswith('GeneralStateTests'):
4460
# General state tests are also exported as blockchain tests. We
45-
# skip them here so we don't run them twice"
61+
# skip them here so we don't run them twice
4662
return True
4763

4864

tests/json-fixtures/test_state.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,20 @@ def expand_fixtures_forks(all_fixtures):
133133
}
134134

135135

136+
# These are tests that are thought to be incorrect or buggy upstream,
137+
# at the commit currently checked out in submodule `fixtures`.
138+
# Ideally, this list should be empty.
139+
# WHEN ADDING ENTRIES, ALWAYS PROVIDE AN EXPLANATION!
140+
INCORRECT_UPSTREAM_TESTS = {
141+
# The test considers a "synthetic" scenario (the state described there can't
142+
# be arrived at using regular consensus rules).
143+
# * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418775512
144+
# The result is in conflict with the yellow-paper:
145+
# * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418800369
146+
('stRevertTest/RevertInCreateInInit.json', 'RevertInCreateInInit', 'Byzantium', 0),
147+
}
148+
149+
136150
def mark_statetest_fixtures(fixture_path, fixture_key, fixture_fork, fixture_index):
137151
fixture_id = (fixture_path, fixture_key, fixture_fork, fixture_index)
138152
if fixture_path.startswith('stTransactionTest/zeroSigTransa'):
@@ -144,6 +158,8 @@ def mark_statetest_fixtures(fixture_path, fixture_key, fixture_fork, fixture_ind
144158
return pytest.mark.skip("Skipping slow test")
145159
elif fixture_path.startswith('stQuadraticComplexityTest'):
146160
return pytest.mark.skip("Skipping slow test")
161+
elif fixture_id in INCORRECT_UPSTREAM_TESTS:
162+
return pytest.mark.xfail(reason="Listed in INCORRECT_UPSTREAM_TESTS.")
147163

148164

149165
def pytest_generate_tests(metafunc):

tests/trinity/json-fixtures-over-rpc/test_rpc_fixtures.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@
9292
'DelegateCallSpam_EIP150',
9393
)
9494

95+
# These are tests that are thought to be incorrect or buggy upstream,
96+
# at the commit currently checked out in submodule `fixtures`.
97+
# Ideally, this list should be empty.
98+
# WHEN ADDING ENTRIES, ALWAYS PROVIDE AN EXPLANATION!
99+
INCORRECT_UPSTREAM_TESTS = {
100+
# The test considers a "synthetic" scenario (the state described there can't
101+
# be arrived at using regular consensus rules).
102+
# * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418775512
103+
# The result is in conflict with the yellow-paper:
104+
# * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418800369
105+
('GeneralStateTests/stRevertTest/RevertInCreateInInit_d0g0v0.json', 'RevertInCreateInInit_d0g0v0_Byzantium'), # noqa: E501
106+
}
107+
95108
RPC_STATE_NORMALIZERS = {
96109
'balance': remove_leading_zeros,
97110
'code': empty_to_0x,
@@ -162,6 +175,8 @@ def blockchain_fixture_mark_fn(fixture_path, fixture_name):
162175
if not should_run_slow_tests():
163176
return pytest.mark.skip("skipping slow test on a quick run")
164177
break
178+
if (fixture_path, fixture_name) in INCORRECT_UPSTREAM_TESTS:
179+
return pytest.mark.xfail(reason="Listed in INCORRECT_UPSTREAM_TESTS.")
165180

166181

167182
def pytest_generate_tests(metafunc):

0 commit comments

Comments
 (0)