Skip to content

Resolving Keccak-256: check if arguments are identifiers early. #11899

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

Merged
merged 1 commit into from
Sep 6, 2021

Conversation

hrkrshnn
Copy link
Member

@hrkrshnn hrkrshnn commented Sep 6, 2021

Previously, the check on whether the optimization was useful gas wise was done before checking if
the keccak256 opcode had identifier as arguments. Since the gas meter crashes when encountering
certain Yul opcodes (create2, dataoffset, etc.), this optimizer step crashed.

Closes #11803 and #11801

@hrkrshnn hrkrshnn force-pushed the move-check-keccak-gas branch from 3afe901 to fbcdd75 Compare September 6, 2021 10:11
@hrkrshnn hrkrshnn force-pushed the move-check-keccak-gas branch from fbcdd75 to 866a26b Compare September 6, 2021 10:12
@hrkrshnn hrkrshnn changed the title Resolving Keccak-256: check if arguments are identifier early. Resolving Keccak-256: check if arguments are identifiers early. Sep 6, 2021
ekpyron
ekpyron previously approved these changes Sep 6, 2021
Copy link
Member

@ekpyron ekpyron left a comment

Choose a reason for hiding this comment

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

Looks good, even though the changelog entry could be polished a bit.

ekpyron
ekpyron previously approved these changes Sep 6, 2021
@hrkrshnn hrkrshnn enabled auto-merge September 6, 2021 11:11
Changelog.md Outdated
@@ -12,6 +12,7 @@ Compiler Features:
* SMTChecker: Add constraints to better correlate ``address(this).balance`` and ``msg.value``.
* SMTChecker: Support the ``value`` option for external function calls.
* Commandline Interface: Disallowed the ``--experimental-via-ir`` option to be used with Standard Json, Assembler and Linker modes.
* Yul Optimizer: Fix a crash in LoadResolver, when ``keccak256`` had particular arguments.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Yul Optimizer: Fix a crash in LoadResolver, when ``keccak256`` had particular arguments.
* Yul Optimizer: Fix a crash in LoadResolver when ``keccak256`` has non-identifier arguments.

Copy link
Member Author

Choose a reason for hiding this comment

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

But not every non-identifier arguments? Maybe I'll change to "has particular non-identifier arguments"?

Copy link
Member Author

@hrkrshnn hrkrshnn Sep 6, 2021

Choose a reason for hiding this comment

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

Changed it. Writing the changelog for this was more work than the fix :)

Copy link
Contributor

@bshastry bshastry left a comment

Choose a reason for hiding this comment

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

Minor comment about Changelog entry.

Previously, the check on whether the optimization was useful gas wise was done before checking if
the keccak256 opcode had identifier as arguments. Since the gas meter crashes when encountering
certain Yul opcodes (create, dataoffset, etc.), this optimizer step crashed.
@hrkrshnn hrkrshnn merged commit e9b70b1 into develop Sep 6, 2021
@hrkrshnn hrkrshnn deleted the move-check-keccak-gas branch September 6, 2021 12:28
@@ -12,6 +12,7 @@ Compiler Features:
* SMTChecker: Add constraints to better correlate ``address(this).balance`` and ``msg.value``.
* SMTChecker: Support the ``value`` option for external function calls.
* Commandline Interface: Disallowed the ``--experimental-via-ir`` option to be used with Standard Json, Assembler and Linker modes.
* Yul Optimizer: Fix a crash in LoadResolver, when ``keccak256`` has particular non-identifier arguments.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bugfix.

Copy link
Member

Choose a reason for hiding this comment

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

Shame on me.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops. Fixed in #11901

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.

dataoffset is unimplemented in GasMeter
4 participants