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

refactor(revm): leverage StorageSlot methods, where appropriate #899

Merged

Conversation

IaroslavMazur
Copy link
Contributor

No description provided.

self.storage
.entry(key)
.or_insert(StorageSlot::new_changed(value, U256::ZERO))
.or_insert(StorageSlot::new(value))
Copy link
Member

@rakita rakita Dec 4, 2023

Choose a reason for hiding this comment

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

This is a different behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is (I hope you're referring to the differences between the logic of new() and new_changed()).

Why create a "changed" StorageSlot, if its present_value is being changed to the very same value as its previous_or_original_value after the execution of .or_insert() - practically, making the StorageSlot instance lose its "changed" status?

FWIW, it's still kinda weird to have .present_value = value; happen after .or_insert(), but this was weird before, as well. Now, present_value is, at least, not set to U256::ZERO, just to be re-set to value right after this.

Or am I missing something here?

Copy link
Member

Choose a reason for hiding this comment

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

I missed something, I just looked at the changed code and saw that it is different, but I didn't see that we override the present_value so it does not matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. Glad we're on the same page now! 🙌🏻

@rakita rakita merged commit 80dccc2 into bluealloy:main Dec 5, 2023
@github-actions github-actions bot mentioned this pull request Jan 12, 2024
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