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

v2.0: fix: borrow stakes delegation during snapshot serialization (backport of #2455) #2500

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Aug 8, 2024

Problem

When serializing snapshots, we do a full deep clone of the stake delegations when serializing Stakes<Delegation>. As of v2.1 this serialization flow is limited to serializing the stakes cache since epoch stakes are serialized with versioned epoch stakes as of #2282.

Summary of Changes

Build a shallow copy of stake delegations by borrowing the delegation field from the stake accounts to avoid allocating so much when serializing Stakes<Delegation> during snapshot creation.

Fixes #


This is an automatic backport of pull request #2455 done by [Mergify](https://mergify.com).

@mergify mergify bot requested a review from a team as a code owner August 8, 2024 15:30
@mergify mergify bot added the conflicts label Aug 8, 2024
@mergify mergify bot assigned jstarry Aug 8, 2024
Copy link
Author

mergify bot commented Aug 8, 2024

Cherry-pick of c99095d has failed:

On branch mergify/bp/v2.0/pr-2455
Your branch is up to date with 'origin/v2.0'.

You are currently cherry-picking commit c99095da98.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   runtime/src/bank.rs
	modified:   runtime/src/bank/partitioned_epoch_rewards/calculation.rs
	modified:   runtime/src/stake_account.rs
	new file:   runtime/src/stakes/serde_stakes.rs
	modified:   sdk/program/src/stake/state.rs

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   runtime/src/bank/serde_snapshot.rs
	both modified:   runtime/src/stakes.rs

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@jstarry
Copy link

jstarry commented Aug 9, 2024

rebased on v2.0 to pickup latest cargo version

@jstarry
Copy link

jstarry commented Aug 9, 2024

Oh still waiting on #2518 to be merged

(cherry picked from commit c99095d)

# Conflicts:
#	runtime/src/bank/serde_snapshot.rs
#	runtime/src/stakes.rs
Copy link
Author

mergify bot commented Aug 9, 2024

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

@jstarry jstarry merged commit e86b3cd into v2.0 Aug 13, 2024
40 checks passed
@jstarry jstarry deleted the mergify/bp/v2.0/pr-2455 branch August 13, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants