Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new(test) Stack validation in CALLF #889

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

shemnon
Copy link
Collaborator

@shemnon shemnon commented Oct 10, 2024

πŸ—’οΈ Description

Add a test to cover cases where stack would not overflow but CALLF stack
reservation rules would cause a revert.

πŸ”— Related Issues

βœ… Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • Tests: A PR with removal of converted JSON/YML tests from ethereum/tests have been opened.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

Add a test to cover cases where stack would not overflow but CALLF stack
reservation rules would cause a revert.

Signed-off-by: Danno Ferrin <[email protected]>
@shemnon shemnon marked this pull request as ready for review October 10, 2024 01:20
Signed-off-by: Danno Ferrin <[email protected]>
Copy link
Collaborator

@pdobacz pdobacz left a comment

Choose a reason for hiding this comment

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

LGTM, minor comments. Do we need to also update eof_tracker.md? I'm not sure but maybe Max stack size (1024) in CALLF-ed function was covering this case, please double check though, I didn't analyze it

Comment on lines 354 to 355
gas_price=10,
protected=False,
Copy link
Collaborator

Choose a reason for hiding this comment

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

gas_price and protected can be left out

Comment on lines 265 to 266
pytest.param(1020, 1, 3, False, id="1020"),
pytest.param(1021, 1, 3, True, id="1021"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pytest.param(1020, 1, 3, False, id="1020"),
pytest.param(1021, 1, 3, True, id="1021"),
pytest.param(1020, 1, 3, False, id="success"),
pytest.param(1021, 1, 3, True, id="failure"),

if we just have these two now (do I understand correctly, the intention is that 1022 would not validate anymore? Or are there other combinations of params which would validate and make sense to test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The essential test is pass below, and fail above. I was considering messing with the input/output levels, but determined it was not essential to the test. I took input and output of the params, and just have stack size and wether we expect failure. Seemed to communicate intent better than embedding what a failure is into the text code.

@shemnon
Copy link
Collaborator Author

shemnon commented Oct 10, 2024

Added another tests to check CALLF when stack is at max ("rule #4") - by EIP this should revert, but there are ways it would succeed without the check, so we need to do one of those ways and then test it.

Signed-off-by: Danno Ferrin <[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.

2 participants