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

[MTG-758] [MTG-802] Rectify close_voter ix #41

Merged
merged 5 commits into from
Oct 17, 2024

Conversation

kstepanovdev
Copy link
Collaborator

@kstepanovdev kstepanovdev commented Oct 15, 2024

To close voter and its ATA an end-user need to pass in all ATA gathered from mints of a Registrar; even if those ATA don't exist, their addresses may still be calculated.

@kstepanovdev kstepanovdev requested a review from StanChe October 15, 2024 10:06
@kstepanovdev kstepanovdev self-assigned this Oct 15, 2024
Copy link
Contributor

@StanChe StanChe left a comment

Choose a reason for hiding this comment

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

With this change we definitely need to document, what should be sent. It's quite counterintuitive to pass in all the possible associated token accounts. Also extending the number of voting mints might make closing the registrar nearly impossible, but that's smth we should just write in comments. Also I'd say we should restrict the positions of the accounts being closed. So we have several voting mints that are not zeroed. And the first remaining account should be for the first non-zeroed voting mint. The second - for the second and so on. This way may have a linear complexity instead of quadratic.

@kstepanovdev kstepanovdev requested a review from StanChe October 17, 2024 12:54
@kstepanovdev kstepanovdev changed the title [MTG-758] Rectify close_voter ix [MTG-758] [MTG-802] Rectify close_voter ix Oct 17, 2024
Copy link
Contributor

@StanChe StanChe left a comment

Choose a reason for hiding this comment

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

Great job! Looks like some redundant checks are there.


for (index, calculated_ata_to_close) in calculated_atas_to_close.enumerate() {
require!(
Copy link
Contributor

Choose a reason for hiding this comment

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

We've already checked this before. What might have changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tunnel vision. Thanks!

@kstepanovdev kstepanovdev merged commit 9cacb93 into audit-fixes Oct 17, 2024
2 checks passed
@kstepanovdev kstepanovdev deleted the audit-fixes-round-3 branch October 17, 2024 15:16
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