-
Notifications
You must be signed in to change notification settings - Fork 23
fix: resolve stuck accounts in process of undelegation #595
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -178,12 +178,12 @@ async fn test_clone_mini_v4_loader_program_and_upgrade() { | |||||
| ) | ||||||
| .await; | ||||||
|
|
||||||
| const MAX_RETRIES: usize = 20; | ||||||
| const MAX_RETRIES: usize = 50; | ||||||
| let mut remaining_retries = MAX_RETRIES; | ||||||
| loop { | ||||||
| ctx.wait_for_delta_slot_ephem(5).unwrap(); | ||||||
|
|
||||||
| let bump = remaining_retries - MAX_RETRIES + 1; | ||||||
| let bump = (remaining_retries - MAX_RETRIES) + 1; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the incorrect bump calculation formula. The current formula produces negative values after the first iteration:
This results in messages like "Hola Mundo 0", "Hola Mundo -1", which is incorrect for a retry counter. Apply this diff to fix the formula: - let bump = (remaining_retries - MAX_RETRIES) + 1;
+ let bump = (MAX_RETRIES - remaining_retries) + 1;This will produce incrementing values: 1, 2, 3, 4, ... as expected for a retry counter. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| let msg = format!("Hola Mundo {bump}"); | ||||||
| let ix = sdk.log_msg_instruction(&payer.pubkey(), &msg); | ||||||
| let (sig, found) = ctx | ||||||
|
|
||||||
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.
Will this be fixed if we set delegation flag to
falseinmagic-programright when undelegation was requested? @thlorenz @GabrielePiccoThere 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.
It would be an improper fix since we don't know if the account was properly undelegated yet.
There is a reason for this two step process.
We will provide a more proper fix soon .. this is just an unblocker.
Uh oh!
There was an error while loading. Please reload this page.
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.
Why is it improper? In context of ER it was undelegated. Everything else is the matter of properly committing it. We shall not bring a network or Intent service related issues into Account state.
In context of ER account it whether delegated or not.
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 think setting the delegation flag to false is necessary but not sufficient to properly handle all edge cases. We also need additional context to determine when an account is awaiting_undelegation, so we can correctly handle transactions that attempt to use that account while it is in the process of being undelegated versus after it has already been undelegated. In the first case, transactions in the ER should fail. In the second case, the cloning pipeline should "re-fetch" the account