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

SELFDESTRUCT must reset contract account #3067

Merged
merged 7 commits into from
Dec 3, 2024
Merged

Conversation

RomarQ
Copy link
Contributor

@RomarQ RomarQ commented Dec 1, 2024

What does it do?

Adds a test to ensure that when a contract is created with CREATE2 and Self Destructed in the same transaction, it can be created again.

The behaviour of SELFDESTRUCT was changed in Cancun hard-fork, where it will recover all funds to the target but not delete the account, except when called in the same transaction as creation.

References:
https://eips.ethereum.org/EIPS/eip-6780

TODO:

⚠️ Breaking Changes ⚠️

Self-destructed contract accounts are now reaped from pallet system to match with the current ethereum behaviour. Users can now deploy the same contract multiple times when using the following instructions: CREATE2 and SELFDESTRUCT. Important to note, we support the eip-6780 specification, where a contract can only be self-destructed when SELFDESTRUCT is called in the same transaction the contract was created.

@RomarQ RomarQ added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. breaking Needs to be mentioned in breaking changes labels Dec 1, 2024
@RomarQ RomarQ requested a review from ahmadkaouk December 1, 2024 21:26
@RomarQ RomarQ self-assigned this Dec 1, 2024
Copy link
Contributor

github-actions bot commented Dec 1, 2024

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2256 KB (no changes) ✅

Moonbeam runtime: 2236 KB (no changes) ✅

Moonriver runtime: 2232 KB (no changes) ✅

Compared to latest release (runtime-3300)

Moonbase runtime: 2256 KB (+228 KB compared to latest release) ⚠️

Moonbeam runtime: 2236 KB (+240 KB compared to latest release) ⚠️

Moonriver runtime: 2232 KB (+240 KB compared to latest release) ⚠️

Copy link
Contributor

github-actions bot commented Dec 1, 2024

Coverage Report

@@                  Coverage Diff                   @@
##           master   rq/fix-selfdestruct     +/-   ##
======================================================
  Coverage   74.70%                74.70%   0.00%     
  Files         369                   369             
  Lines       94308                 94308             
======================================================
- Hits        70446                 70445      -1     
+ Misses      23862                 23863      +1     
Files Changed Coverage
/pallets/moonbeam-foreign-assets/src/lib.rs 70.40% (-0.45%) 🔽

Coverage generated Tue Dec 3 12:04:24 UTC 2024

@RomarQ RomarQ marked this pull request as ready for review December 2, 2024 15:25
@RomarQ RomarQ marked this pull request as draft December 2, 2024 16:15
@RomarQ RomarQ marked this pull request as ready for review December 2, 2024 20:27
ahmadkaouk
ahmadkaouk previously approved these changes Dec 3, 2024
Copy link
Contributor

@ahmadkaouk ahmadkaouk left a comment

Choose a reason for hiding this comment

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

LGTM

@RomarQ RomarQ merged commit 99eebab into master Dec 3, 2024
39 checks passed
@RomarQ RomarQ deleted the rq/fix-selfdestruct branch December 3, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants