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

feat: remove beneficiary from self destruct #1838

Merged
merged 2 commits into from
Sep 21, 2023
Merged

Conversation

Stebalien
Copy link
Member

fixes #1837

@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2023

Codecov Report

Merging #1838 (2f14958) into next (1ced813) will increase coverage by 27.88%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             next    #1838       +/-   ##
===========================================
+ Coverage   28.76%   56.64%   +27.88%     
===========================================
  Files         113      152       +39     
  Lines       10468    15106     +4638     
===========================================
+ Hits         3011     8557     +5546     
+ Misses       7457     6549      -908     
Files Changed Coverage Δ
fvm/src/kernel/default.rs 14.71% <0.00%> (ø)
fvm/src/syscalls/sself.rs 0.00% <0.00%> (ø)
sdk/src/error.rs 0.00% <ø> (ø)
sdk/src/sself.rs 0.00% <0.00%> (ø)

... and 76 files with indirect coverage changes

@Stebalien Stebalien requested review from fridrik01 and anorth August 10, 2023 04:13
Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

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

Changes LGTM, with disclaimer that I'm not familiar enough with FVM internals to know if there are other changes that should have been made too.

Comment on lines +238 to +258
// If there are remaining funds, burn them. We do this instead of letting the user to
// specify the beneficiary as:
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I don't get is If there are remaining funds, why don't we just fail the self destruct altogether requiring the user to explicitly transfer (or burn) the funds himself?

Copy link
Member Author

Choose a reason for hiding this comment

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

We considered that and I'm happy to go that way. I did it this way because it's most likely to "just work". E.g., you write a smart contract that never even expects to have native tokens and someone sends you some anyways.

On the other hand, now that I revisit this... I'm more convinced we should just fail. That ensures that fund transfers can only happen on "send" (and actor creation), not through other means.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, kind of. On the other hand, I'm not sure if that matters. Basically, when an actor self destructs, it does kind of make sense to destroy the funds automatically. Technically it's sending them to the burnt funds actor, but that's more of an implementation detail than anything.

Copy link
Contributor

Choose a reason for hiding this comment

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

Achieving zero funds can be hard in cases where this account is paying for gas. While it might not be a worry right now (as key accounts cannot self-destruct), in case of Account Abstraction it gets harder.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. In that world, I'll require that the user pass specify that they want remaining funds burnt.

@Stebalien
Copy link
Member Author

Stebalien commented Aug 11, 2023

@anorth I've changed this logic to implement your suggestion from filecoin-project/FIPs#524 (comment). That way the user has to explicitly decide whether they want to burn remaining funds or fail if there are remaining funds.

@Stebalien Stebalien merged commit 02cc416 into next Sep 21, 2023
@Stebalien Stebalien deleted the steb/self-destruct branch September 21, 2023 19:01
Stebalien added a commit that referenced this pull request Sep 21, 2023
Stebalien added a commit that referenced this pull request Sep 21, 2023
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.

5 participants