Skip to content

Remove pub from AccountMapEntryMeta fields#8341

Merged
kskalski merged 1 commit intoanza-xyz:masterfrom
kskalski:ks/no_pub_meta
Oct 6, 2025
Merged

Remove pub from AccountMapEntryMeta fields#8341
kskalski merged 1 commit intoanza-xyz:masterfrom
kskalski:ks/no_pub_meta

Conversation

@kskalski
Copy link
Copy Markdown

@kskalski kskalski commented Oct 6, 2025

Problem

  • AccountMapEntryMeta has pub fields
  • it is itself in a pub field in AccountMapEntry

This exposure is unnecessary

Summary of Changes

Remove pub attributes

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.2%. Comparing base (83ea244) to head (f554e34).

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #8341     +/-   ##
=========================================
- Coverage    83.2%    83.2%   -0.1%     
=========================================
  Files         838      838             
  Lines      368481   368481             
=========================================
- Hits       306709   306702      -7     
- Misses      61772    61779      +7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kskalski kskalski marked this pull request as ready for review October 6, 2025 14:49
Copy link
Copy Markdown

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

Overall I agree with removing pub from AccountMapEntry::meta.

I'm indifferent for AccountMapEntryMeta though. Since the struct itself is pub, probably safer to make its field private, so works for me.

Comment on lines 143 to 147
fn new(dirty: bool, age: Age) -> Self {
AccountMapEntryMeta {
dirty: AtomicBool::new(false),
age: AtomicAge::new(storage.future_age_to_flush(false)),
dirty: AtomicBool::new(dirty),
age: AtomicAge::new(age),
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm actually mostly against constructors that just wrap struct initialization. Especially when they are private.

These changes seem unnecessary to just remove the pub from AccountMapEntry and AccountMapEntryMeta fields, at least. So the PR is now doing more stuff than I think is necessary.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm adding constructors, because I want to add a field to meta, that callers shouldn't really (be forced to) initialize.
But I think the exact choice of how and where initialization happens actually changed after #8337, so your point makes sense.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Mainly I think this PR could be three lines of removing pub and it would be an easy approval. Could add ctors in separate PRs that actually use/need them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

ref_count: AtomicRefCount::default(),
meta: AccountMapEntryMeta::default(),
}
Self::new(SlotList::new(), 0, AccountMapEntryMeta::default())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same here.

HaoranYi
HaoranYi previously approved these changes Oct 6, 2025
Copy link
Copy Markdown

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

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

LGTM.

@kskalski kskalski merged commit d946ae2 into anza-xyz:master Oct 6, 2025
43 checks passed
@kskalski kskalski deleted the ks/no_pub_meta branch October 10, 2025 03:24
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.

4 participants