-
Notifications
You must be signed in to change notification settings - Fork 4
Fix/ephemeral balance undelegation 2.0 #77
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
Conversation
…em program. Added new version of close_ephemeral_balance to support it. kept old one for backward-compatability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the current approach is not ideal, as the discriminator is only set on delegation (which defeat the idea of using it as a filter to get all escrow accounts), plus the handling of the callback becomes hacky. I prosed in this PR an implementation that it's simpler by removing the discriminator: #78
* fix: remove discriminator * chore: simplify fix * fix: delegation record with system program as owner & add tests
Problem
What problem are you trying to solve?
Solution
How did you solve the problem?
Before & After Screenshots
Insert screenshots of example code output
BEFORE:
[insert screenshot here]
AFTER:
[insert screenshot here]
Other changes (e.g. bug fixes, small refactors)
Deploy Notes
Notes regarding deployment of the contained body of work. These should note any
new dependencies, new scripts, etc.
New scripts:
script
: script detailsNew dependencies:
dependency
: dependency detailsGreptile Summary
Here's my concise review of the ephemeral balance undelegation changes:
Adds external undelegation functionality and improves ephemeral balance account management in the delegation program.
ExternalUndelegate
instruction (discriminator 15) insrc/discriminator.rs
to handle external undelegation of accounts owned by DLPclose_ephemeral_balance.rs
to use direct system program transfers instead ofclose_pda
helper, with proper ownership verificationEphemeralBalance
struct (discriminator 104) insrc/state/ephemeral_balance.rs
as a marker type for temporary balance accountstest_top_up.rs
verifying ownership transfers and account closure during undelegationto_bytes
a const function and adding proper initialization checksThe changes appear well-structured and properly integrated with existing functionality, with good test coverage for the new features.