Skip to content

program: Add note about state types#74

Merged
febo merged 2 commits into
mainfrom
febo/pod-note
Jun 2, 2026
Merged

program: Add note about state types#74
febo merged 2 commits into
mainfrom
febo/pod-note

Conversation

@febo
Copy link
Copy Markdown
Contributor

@febo febo commented Jun 1, 2026

Problem

Account types are loaded directly from account data, so only pod-like types must be used.

Solution

Add a note to the implementation of account types.

@febo febo requested a review from joncinque June 2, 2026 08:43
Comment thread program/src/state/data.rs Outdated
Comment on lines +6 to +9
//
// Note: `Data` may be loaded directly from account data after only a
// length check (no owner check). All fields must be valid for any bit
// pattern.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: it's a bit strange to say that a tagged union must be valid for any bit pattern, since that isn't the case. The constructor even takes in the DataSource to figure out which variant to create.

Would it make more sense to add this comment on the variant types themselves? Meaning, instead put the comment on DirectData, UrlData, and ExternalData

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point! The comment is only applicable for ExternalData, which is a struct, so I moved it there.

@febo febo requested a review from joncinque June 2, 2026 09:35
Copy link
Copy Markdown
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great!

@febo febo merged commit bb5032e into main Jun 2, 2026
21 checks passed
@febo febo deleted the febo/pod-note branch June 2, 2026 10:04
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