-
Notifications
You must be signed in to change notification settings - Fork 169
chore(tests): add modexp length mismatch functionality #2058
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.
This is still not fully consistent and I don't think you can reliably compute gas using this higher level structure. One reason is pointed out in the inline comment. Another reason is you can use raw_input=
(and there are good reasons to do so) and then all the additional properties (e.g. length_base
) are garbage. Same as the computed gas.
This precompile has ultimately complex input structure. If you want something reliable consider this: you can have reach set of constructors and/or constructor arguments for readability. But you should immediately build input bytes out of them. And the gas cost must be computed from bytes. EELS has it already so you can copy the code for start.
tests/osaka/eip7823_modexp_upper_bounds/test_modexp_upper_bounds.py
Outdated
Show resolved
Hide resolved
@@ -86,6 +128,26 @@ def from_bytes(cls, input_data: Bytes | str) -> "ModExpInput": | |||
|
|||
return cls(base=base, exponent=exponent, modulus=modulus, raw_input=input_data) | |||
|
|||
@classmethod | |||
def create_mismatch( |
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.
This feels a bit too much for me. I generally struggle with some data types in EEST which have a lot of interconnected options and flags.
This could be a normal constructor. And you can fix the properties directly in the constructor like:
length_base = declared_base_length if declared_base_length not None else len(base)
61c67db
to
d30b8ec
Compare
Updated regarding the comments using the EELS like approach.. |
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! LGTM
🗒️ Description
Aims to update the modexp helpers to allow for length mismatch tests.
Length mismatch tests can be added with the following, copied over and refactored from #2044.
🔗 Related Issues or PRs
Fixes #2043 (attemps to).
✅ Checklist
tox
checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlint
type(scope):
.