Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Allow non-numeric immutable keys in contract-schema and add test of Yul immutable recognition #4746

Merged
merged 2 commits into from
Feb 17, 2022

Conversation

haltman-at
Copy link
Contributor

@haltman-at haltman-at commented Feb 17, 2022

As of Solidity 0.8.12, we can now get immutableReferences from Yul contracts that use immutables. However, the keys for these are not numeric AST IDs, but rather simply the names of the immutables. So, I'm taking out the patternProperties and replacing it with additionalProperties, since the keys can now be anything.

This PR doesn't do the work of allowing us to actually do things with Yul immutables, like decode them. I figure that can come later (I've put up issue #4747 for that). This is just updating the contract schema.

Note: I checked our existing immutable-handling code and as best I can tell this shouldn't screw any of it up.

Edit: Actually, you know what, I was a little bit unsatisfied with this, so I went back and added a test -- not a test of the contract-schema change of course, that should have no functional effect at the moment; but a test that yes, the debugger can indeed use Yul's immutableReferences to correctly recognize Yul code with immutables in it (without any code changes to codec or the debugger necessary :) ). Obviously this required updating the debugger tests to Solidity 0.8.12...

@haltman-at haltman-at changed the title Allow non-numeric immutable keys in contract-schema Allow non-numeric immutable keys in contract-schema and add test of Yul immutable recognition Feb 17, 2022
Copy link
Member

@cds-amal cds-amal left a comment

Choose a reason for hiding this comment

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

Edit: Actually, you know what, I was a little bit unsatisfied with this, so I went back and added a test -- not a test of the contract-schema change of course, that should have no functional effect at the moment; but a test that yes, the debugger can indeed use Yul's immutableReferences to correctly recognize Yul code with immutables in it (without any code changes to codec or the debugger necessary :) ). Obviously this required updating the debugger tests to Solidity 0.8.12...

YES! I love this.

@@ -25,7 +25,7 @@ export async function prepareContracts(provider, sources = {}, migrations) {

config.compilers = {
solc: {
version: "0.8.9",
version: "0.8.12",
settings: {
optimizer: { enabled: false, runs: 200 },
Copy link
Member

@cds-amal cds-amal Feb 17, 2022

Choose a reason for hiding this comment

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

This is not part of this PR's changes but I'm curious what this optimizer settings does, enabled is false and runs is 200?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, yeah, runs does nothing if enabled is false. This is just how that's been, I've never bothered to alter that. I assume it's copied from the config defaults, which is also like that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants