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

core/state: invoke OnCodeChange-hook on selfdestruct #30686

Merged
merged 3 commits into from
Nov 8, 2024

Conversation

kchojn
Copy link
Contributor

@kchojn kchojn commented Oct 28, 2024

Implemented code change tracking for selfdestruct operations by adding OnCodeChange hooks in the SelfDestruct and SelfDestruct6780 methods of the hookedStateDB structure.

Motivation:
Now, we can track OnCodeChange when the contract is deployed. It would be nice also to be able to track changes (code, codeHash) when the contract is destroyed.

Let me know if this makes sense or if I need to improve/fix anything

@s1na
Copy link
Contributor

s1na commented Oct 29, 2024

I think the change makes sense. But let's do it together with #30441 as part of a single release.

@maoueh wondering how you are handling this right now. Listening to OnEnter and manually clear the code?

Copy link
Member

@rjl493456442 rjl493456442 left a comment

Choose a reason for hiding this comment

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

sgtm

@kchojn
Copy link
Contributor Author

kchojn commented Oct 29, 2024

I think the change makes sense. But let's do it together with #30441 as part of a single release.

@maoueh wondering how you are handling this right now. Listening to OnEnter and manually clear the code?

@s1na Should I do something about this pr now?
When is the expected time merge #30441 pr?

@maoueh
Copy link
Contributor

maoueh commented Oct 29, 2024

wondering how you are handling this right now. Listening to OnEnter and manually clear the code?

Correct, we work with the OnEnter and check if is a SELFDestruct to deal with this.

@rjl493456442 rjl493456442 added this to the 1.14.12 milestone Nov 1, 2024
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

lgtm

@holiman holiman changed the title core/state: Add code change tracking (OnCodeChange) for selfdestruct core/state: invoke OnCodeChange-hook on selfdestruct Nov 8, 2024
@holiman holiman merged commit 3c7336b into ethereum:master Nov 8, 2024
3 checks passed
holiman pushed a commit that referenced this pull request Nov 19, 2024
This change invokes the OnCodeChange hook when selfdestruct operation is performed, and a contract is removed. This is an event which can be consumed by tracers.
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.

7 participants