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

Prevent account permissions for receive and access from being changed #58

Merged
merged 3 commits into from
May 28, 2024

Conversation

kantp
Copy link
Collaborator

@kantp kantp commented May 27, 2024

No description provided.

@kantp kantp requested a review from harrysolovay as a code owner May 27, 2024 15:08
mitschabaude
mitschabaude previously approved these changes May 27, 2024
FungibleToken.ts Outdated
Comment on lines 154 to 155
this.checkZeroBalanceChange(updates)
this.forEachUpdate(updates, (update, _usesToken) => this.checkPermissionsUpdate(update))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would do it like the wMina example and combine the logic into a single call to this.forEachUpdate(). Stepping through the tree of account updates comes with a lot of overhead (hashing of account updates!), about 10k constraints IIRC, so it's better to do it just once

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, that's a good point! I'll change that.

@@ -423,6 +424,26 @@ describe("token integration", () => {
})
})

describe("account permissions", () => {
it("should reject a transaction that's changing the account permission for receive", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice test!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks!

Doing one pass over the account updates instead of two
@kantp kantp merged commit 17ee8c2 into main May 28, 2024
3 checks passed
@kantp kantp deleted the kantp/protect-permissions branch May 28, 2024 10:11
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