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

Need help understanding 9-closing-accounts secure vs insecure-still-still #4

Closed
billythedummy opened this issue Feb 9, 2022 · 1 comment · Fixed by #5
Closed

Need help understanding 9-closing-accounts secure vs insecure-still-still #4

billythedummy opened this issue Feb 9, 2022 · 1 comment · Fixed by #5

Comments

@billythedummy
Copy link
Contributor

billythedummy commented Feb 9, 2022

Sorry I don't quite see what the purpose of the force_defund() instruction is or how it makes it secure in contrast to insecure-still-still. From its naming it seems like it's supposed to force the defunding of closed accounts? If so, should it be

if discriminator != CLOSED_ACCOUNT_DISCRIMINATOR

on https://github.com/project-serum/sealevel-attacks/blob/2902c7976a36ddd34e16022026e8d64cf1667974/programs/9-closing-accounts/secure/src/lib.rs#L41-L43 instead?

Is the fact that it's a different instruction supposed to demonstrate that the only way to force the defunding of a closed account is to start a new transaction that calls force_defund() after close() has been called in a previous transaction (because otherwise users are free to append TransferLamports instructions to the same transaction in which close() was called)?

@billythedummy
Copy link
Contributor Author

saw coral-xyz/anchor#613, understood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant