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

Do not derive Copy for EpochSchedule and Rent #32767

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

apfitzge
Copy link
Contributor

@apfitzge apfitzge commented Aug 8, 2023

Problem

In #32547, I added a clippy allow lint for CloneZeroed types that were Copy to have an "incorrect" clone. For any Copy types, clippy considers a clone that is anything other than Copy to be incorrect.

EpochSchedule and Rent turned out to be the only Copy types using this derive macro.

Summary of Changes

  • EpochSchedule no longer derives Copy
  • Rent no longer derives Copy
  • Replace use of Copy by Clone (this will ensure padding bytes are zero consistently)
  • Use references where appropriate

Fixes #32588

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #32767 (83843dc) into master (8a298f1) will decrease coverage by 0.1%.
Report is 1 commits behind head on master.
The diff coverage is 100.0%.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #32767     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         819      819             
  Lines      219129   219131      +2     
=========================================
- Hits       179532   179498     -34     
- Misses      39597    39633     +36     

@apfitzge apfitzge marked this pull request as ready for review August 9, 2023 17:25
ledger/src/leader_schedule_cache.rs Outdated Show resolved Hide resolved
@@ -1470,7 +1470,7 @@ impl Bank {
);
} else {
// Save a snapshot of stakes for use in consensus and stake weighted networking
let leader_schedule_epoch = epoch_schedule.get_leader_schedule_epoch(slot);
let leader_schedule_epoch = new.epoch_schedule().get_leader_schedule_epoch(slot);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

brooksprumo
brooksprumo previously approved these changes Aug 9, 2023
Copy link
Contributor

@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.

lgtm, thanks!

@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Aug 24, 2023
@apfitzge
Copy link
Contributor Author

this got stale because there was a merge conflict I didn't resolve for a bit.

I think some of this may conflict with changes #32961 (or related PRs) has. So going to just hold this off until those get merged.

@github-actions github-actions bot removed the stale [bot only] Added to stale content; results in auto-close after a week. label Aug 25, 2023
@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Sep 8, 2023
@github-actions github-actions bot closed this Sep 15, 2023
@Lichtso
Copy link
Contributor

Lichtso commented Sep 15, 2023

@apfitzge I think you can rebase

@Lichtso Lichtso reopened this Sep 15, 2023
@github-actions github-actions bot removed the stale [bot only] Added to stale content; results in auto-close after a week. label Sep 18, 2023
@apfitzge apfitzge changed the title Do not derive Copy for EpochSchedule Do not derive Copy for EpochSchedule and Rent Sep 18, 2023
@apfitzge
Copy link
Contributor Author

Some downstream issues w/ removing Copy from EpochSchedule in stake_pool. Will have to look at how that's being used

@apfitzge
Copy link
Contributor Author

SPL fix PR: solana-labs/solana-program-library#5323

@apfitzge
Copy link
Contributor Author

SPL fix PR: solana-labs/solana-program-library#5323

Hmm must have been another issue in SPL. I had run cargo test-sbf which I thought would have run all the tests. Will have to check again tomorrow...

@apfitzge
Copy link
Contributor Author

Finally fixed all the SPL stuff 😦 @Lichtso, @brooksprumo

brooksprumo
brooksprumo previously approved these changes Sep 25, 2023
Copy link
Contributor

@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.

Lgtm. Probably worthwhile to wait for approval from the other reviewers as well.

@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Oct 10, 2023
@github-actions github-actions bot closed this Oct 18, 2023
@apfitzge apfitzge reopened this Oct 19, 2023
@apfitzge
Copy link
Contributor Author

@Lichtso had to rebase this again, but should be in a good state again now.

@apfitzge apfitzge removed the stale [bot only] Added to stale content; results in auto-close after a week. label Oct 19, 2023
@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Nov 2, 2023
@apfitzge apfitzge removed the stale [bot only] Added to stale content; results in auto-close after a week. label Nov 3, 2023
@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Nov 17, 2023
@github-actions github-actions bot removed the stale [bot only] Added to stale content; results in auto-close after a week. label Nov 21, 2023
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.

CloneZero macro and Copy types
3 participants