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

v1.18: Cli stake-split: adjust transfer amount if recipient has lamports (backport of #266) #369

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Mar 21, 2024

Problem

The #162 cli change permits split recipients that carry a lamports balance. However, the message builder below always funds the account with the full rent-exempt reserve regardless of such an existing balance.

Summary of Changes

Some refactoring to make cases easier to follow (review by commit will be best)
Subtract (saturating) any existing lamports balance from the transfer amount


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

@mergify mergify bot added the conflicts label Mar 21, 2024
Copy link
Author

mergify bot commented Mar 21, 2024

Cherry-pick of dff99d0 has failed:

On branch mergify/bp/v1.18/pr-266
Your branch is up to date with 'origin/v1.18'.

You are currently cherry-picking commit dff99d0740.
  (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:   cli/src/cli.rs

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   cli/src/stake.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

@CriesofCarrots
Copy link

This is a solana-cli-only change, which builds on (needs rebase on) #368
Both these PRs remove obstacles that exist for splitting stake now that solana-labs#33300 is active everywhere.

* Remove incorrect check

* Move to closure

* Use match statement instead

* Adjust rent_exempt_reserve by existing balance

* Only transfer lamports if rent_exempt_reserve needs are greater than 0

* Rename variable for clarity

* Add minimum-delegation check

* Bump test split amount to meet arbitrary mock minimum-delegation amount

(cherry picked from commit dff99d0)

# Conflicts:
#	cli/src/stake.rs
Copy link

@willhickey willhickey left a comment

Choose a reason for hiding this comment

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

Approved for beta

@CriesofCarrots CriesofCarrots merged commit 7606adf into v1.18 Mar 22, 2024
35 checks passed
@CriesofCarrots CriesofCarrots deleted the mergify/bp/v1.18/pr-266 branch March 22, 2024 04:46
anwayde pushed a commit to firedancer-io/agave that referenced this pull request Jul 23, 2024
…rts (backport of anza-xyz#266) (anza-xyz#369)

Cli stake-split: adjust transfer amount if recipient has lamports (anza-xyz#266)

* Remove incorrect check

* Move to closure

* Use match statement instead

* Adjust rent_exempt_reserve by existing balance

* Only transfer lamports if rent_exempt_reserve needs are greater than 0

* Rename variable for clarity

* Add minimum-delegation check

* Bump test split amount to meet arbitrary mock minimum-delegation amount

(cherry picked from commit dff99d0)

# Conflicts:
#	cli/src/stake.rs

Co-authored-by: Tyera <[email protected]>
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