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

[contract] fund settlement with non-delegated lamports #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ochaloup
Copy link
Contributor

Currently when one tries to fund the Settlement with a stake account containing the larger amount of non-delegated lamports (bigger to funded amount + stake account rent) then the instruction fails.
It's because the stake program split instruction places all non-delegate lamports into the origin stake account and the rest is moved into a split. If the amount of non-delegated lamports is so many that the original stake account won't be a valid delegated stake account (a valid stake account needs to have delegated to a minimum of 1 SOL, at least per expected feature gate) then it ends failing.

I do propose a PR to fix the issue of funding Settlements with non-delegated lamports (when more of them available in a stake account).

But I'm not fully happy with the current result. I realized I needed to combine manual withdrawal with split and delegate to get the wanted behaviour. The fund settlement instruction started to be even more complicated than before, and I failed to make it somehow more readable.

Any input is appreciated.
(and I assume the task not being of the highest priority)

@ochaloup ochaloup requested a review from janlegner July 24, 2024 16:19
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.

None yet

1 participant