Skip to content

EIP-2681: Limit account nonce to 2^64-1 - Create Test Cases#454

Merged
SamWilsn merged 2 commits intoethereum:masterfrom
gurukamath:test_high_nonce
Feb 15, 2022
Merged

EIP-2681: Limit account nonce to 2^64-1 - Create Test Cases#454
SamWilsn merged 2 commits intoethereum:masterfrom
gurukamath:test_high_nonce

Conversation

@gurukamath
Copy link
Contributor

(closes #401 )

What was wrong?

The Non-Legacy tests were not implemented.
These tests include ones for exceptional halting of CREATE opcode when the nonce is high

Related to Issue #401

How was it fixed?

Added the High Nonce tests out of tests/fixtures/BlockchainTests/GeneralStateTests/

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov-commenter
Copy link

Codecov Report

Merging #454 (5230bfb) into master (0e3c03b) will increase coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #454      +/-   ##
==========================================
+ Coverage   79.36%   79.45%   +0.08%     
==========================================
  Files         187      187              
  Lines        9864     9864              
==========================================
+ Hits         7829     7837       +8     
+ Misses       2035     2027       -8     
Flag Coverage Δ
unittests 79.45% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ethereum/spurious_dragon/vm/instructions/system.py 95.54% <0.00%> (+0.99%) ⬆️
...hereum/tangerine_whistle/vm/instructions/system.py 98.98% <0.00%> (+1.01%) ⬆️
src/ethereum/homestead/vm/instructions/system.py 97.29% <0.00%> (+1.08%) ⬆️
src/ethereum/frontier/vm/instructions/system.py 98.64% <0.00%> (+1.35%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e3c03b...5230bfb. Read the comment docs.

Copy link
Contributor

@SamWilsn SamWilsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty decent to me. Would you mind taking a peek, @voith, when you get the chance?

json_data = json.load(fp)[f"{test_name}_{network}"]
data = json.load(fp)

# Some newer test files have for example _d0g0v0_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what these blobs mean?

cc. @lightclient

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure. But they do appear in both, the legacy as well as non-legacy tests. In the non-legacy tests, there is a slight discrepancy that this pattern does not appear in the file name but appears in the keys within, which is why I had to implement this pattern matching

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data 0 gas 0 value 0, iirc?

# Some newer test files have for example _d0g0v0_
# between test_name and network
keys_to_search = re.compile(
f"{test_name}_d[0-9]g[0-9]v[0-9]_{network}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a good idea to re.escape these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the regex meta-characters that we have passed in will be appropriately handled by re.compile. And no meta-characters appear in the test_name as far as I have seen. So, we should be ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the same function for legacy tests and the new tests, would it make sense to have a separate function for handling the new tests?

Copy link
Contributor

@voith voith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Besides the one comment that I left.

# Some newer test files have for example _d0g0v0_
# between test_name and network
keys_to_search = re.compile(
f"{test_name}_d[0-9]g[0-9]v[0-9]_{network}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the same function for legacy tests and the new tests, would it make sense to have a separate function for handling the new tests?

@gurukamath
Copy link
Contributor Author

@voith @SamWilsn Thanks for the feedback.

After considering the points that you raised, I did a detailed analysis of the GeneralStateTests cases within the legacy and non-legacy tests. I also looked at the keys that they use.

Here are the important points

  1. A small number of test case names do in fact have regex meta-charactes in their names Eg:- mem64kb_singleByte+32. So we will have to do an re.escape after all :)
  2. Occasionally, the keys in the new test case have larger numbers between the letters d g v and not just a single digit as I previously thought. Example:- sstore_combinations_initial21_2_d452g0v0_Berlin inside sstore_combinations_initial21_2.json

I say we just keep it simple and handle it all with the same regex f"{re.escape(test_name)}.*{re.escape(network)}" i.e starts with test_name and ends with network without worrying about what occurs in the middle. This handles old and new test cases in one go.

I have already tested this and it picks up exactly all the tests that we've been running thus far. Let me know what you think and I'll update the PR accordingly.

@gurukamath
Copy link
Contributor Author

Updated as described in the comment above

@SamWilsn
Copy link
Contributor

I think, for the time being, I'm fine with using a single function for both styles of test.

@SamWilsn SamWilsn merged commit 5ea89ca into ethereum:master Feb 15, 2022
@gurukamath gurukamath deleted the test_high_nonce branch February 25, 2022 20:12
Carsons-Eels pushed a commit to Carsons-Eels/execution-specs that referenced this pull request Oct 16, 2025
* feat(fw): Add sha256 hash to fixtures

* feat: add hasher script

* changelog

* src/ethereum_test_tools/test_filling: add `_info/hash` to framework tests. (ethereum#16)

* fix(entry): Add short flags

* docs: add hasher to `verifying_changes.md`

---------

Co-authored-by: spencer <[email protected]>
danceratopz pushed a commit to danceratopz/execution-specs that referenced this pull request Oct 22, 2025
* feat(fw): Add sha256 hash to fixtures

* feat: add hasher script

* changelog

* src/ethereum_test_tools/test_filling: add `_info/hash` to framework tests. (#16)

* fix(entry): Add short flags

* docs: add hasher to `verifying_changes.md`

---------

Co-authored-by: spencer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EIP-2681: Limit account nonce to 2^64-1

5 participants