-
Notifications
You must be signed in to change notification settings - Fork 169
Enforce keyword-only arguments in calldata_gas_calculator methods #1714
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this.
My main concern is that this code could break if we convert only one of the fork methods at a time:
execution-spec-tests/src/ethereum_test_forks/transition_base_fork.py
Lines 64 to 81 in d6252aa
def transition_method( | |
cls, | |
block_number: int = ALWAYS_TRANSITIONED_BLOCK_NUMBER, | |
timestamp: int = ALWAYS_TRANSITIONED_BLOCK_TIMESTAMP, | |
): | |
kwargs = {} | |
if "block_number" in base_method_parameters: | |
kwargs["block_number"] = block_number | |
if "timestamp" in base_method_parameters: | |
kwargs["timestamp"] = timestamp | |
if getattr(base_method, "__prefer_transition_to_method__", False): | |
return to_fork_method(**kwargs) | |
return ( | |
to_fork_method(**kwargs) | |
if block_number >= at_block and timestamp >= at_timestamp | |
else from_fork_method(**kwargs) | |
) |
I think we need to transform all the abstract method in BaseFork
at the same time, which could be a major chore.
That makes sense, I went ahead and updated all the abstract methods in BaseFork to enforce keyword-only args, along with their implementations and calls. Let me know if I missed anything. |
🗒️ Description
This PR modifies the
calldata_gas_calculator
method in the base and derived fork classes to enforce keyword-only arguments forblock_number
andtimestamp
using*
.All method calls across the codebase have been updated to explicitly use keyword arguments.
I wasn't able to run the test suite locally due to a missing plugin error (
pytest_plugins.concurrency
), but the changes were made carefully and consistently. Please let me know if you'd like help resolving test setup.🔗 Related Issues
Fixes #1709
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.