Skip to content

program: Improve zero authority check - #61

Merged
febo merged 1 commit into
mainfrom
febo/zero-authority
May 18, 2026
Merged

febo merged 1 commit into
mainfrom
febo/zero-authority

Conversation

@febo

@febo febo commented May 18, 2026

Copy link
Copy Markdown
Contributor

Problem

While authority field on buffer and metadata accounts is Zeroable, allowing to remove the authority passing Some(Address::ZERO) is counterintuitive.

Solution

Add a check to prevent removing the authority by setting one as Address::ZERO.

@febo
febo requested a review from lorisleiva May 18, 2026 10:53

@lorisleiva lorisleiva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interesting, could we not accept a regular Option<Address> instead of a Zeroable one?

@febo

febo commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

Interesting, could we not accept a regular Option<Address> instead of a Zeroable one?

We would need an extra byte on the account data. But I don't think it is too bad to have the extra check.

@febo
febo merged commit 83d0b7f into main May 18, 2026
9 checks passed
@febo
febo deleted the febo/zero-authority branch May 18, 2026 14:25
@lorisleiva

Copy link
Copy Markdown
Member

I'm confused sorry. Address and ZeroableAddress have the same length right? If so, Option<Address> and Option<ZeroableAddress> should also have the same length (not matter how you serialise Option).

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