-
Notifications
You must be signed in to change notification settings - Fork 23
Strip failed undelegations #640
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
f6dbd15
c14207e
a913a02
29474b1
29b1022
5535356
086bcb8
3aa0884
150554e
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -445,6 +445,35 @@ where | |||||||||
| (commit_strategy, finalize_strategy, to_cleanup) | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /// Handles actions error, stripping away actions | ||||||||||
| /// Returns [`TransactionStrategy`] to be cleaned up | ||||||||||
|
Comment on lines
+448
to
+449
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 copy-paste error in documentation. The comment says "Handles actions error, stripping away actions" but this method handles undelegation errors. Apply this diff: - /// Handles actions error, stripping away actions
+ /// Handles undelegation error, stripping away undelegation and subsequent tasks
/// Returns [`TransactionStrategy`] to be cleaned up📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| fn handle_undelegation_error( | ||||||||||
| &self, | ||||||||||
| strategy: &mut TransactionStrategy, | ||||||||||
| ) -> TransactionStrategy { | ||||||||||
| let position = strategy | ||||||||||
| .optimized_tasks | ||||||||||
| .iter() | ||||||||||
| .position(|el| el.task_type() == TaskType::Undelegate); | ||||||||||
|
|
||||||||||
| if let Some(position) = position { | ||||||||||
| // Remove everything after undelegation including post undelegation actions | ||||||||||
| let removed_task = | ||||||||||
| strategy.optimized_tasks.drain(position..).collect(); | ||||||||||
| let old_alts = | ||||||||||
| strategy.dummy_revaluate_alts(&self.authority.pubkey()); | ||||||||||
| TransactionStrategy { | ||||||||||
| optimized_tasks: removed_task, | ||||||||||
| lookup_tables_keys: old_alts, | ||||||||||
| } | ||||||||||
| } else { | ||||||||||
| TransactionStrategy { | ||||||||||
| optimized_tasks: vec![], | ||||||||||
| lookup_tables_keys: vec![], | ||||||||||
| } | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /// Shared helper for sending transactions | ||||||||||
| async fn send_prepared_message( | ||||||||||
| &self, | ||||||||||
|
|
@@ -520,7 +549,8 @@ where | |||||||||
| } | ||||||||||
| Err(IntentExecutorError::CommitIDError(_, _)) | ||||||||||
| | Err(IntentExecutorError::ActionsError(_, _)) | ||||||||||
| | Err(IntentExecutorError::CpiLimitError(_, _)) => None, | ||||||||||
| | Err(IntentExecutorError::CpiLimitError(_, _)) | ||||||||||
| | Err(IntentExecutorError::UndelegationError(_, _)) => None, | ||||||||||
| Err(IntentExecutorError::EmptyIntentError) | ||||||||||
| | Err(IntentExecutorError::FailedToFitError) | ||||||||||
| | Err(IntentExecutorError::TaskBuilderError(_)) | ||||||||||
|
|
@@ -758,6 +788,8 @@ where | |||||||||
| let result = self.execute_inner(base_intent, &persister).await; | ||||||||||
| if let Some(pubkeys) = pubkeys { | ||||||||||
| // Reset TaskInfoFetcher, as cache could become invalid | ||||||||||
| // NOTE: if undelegation was removed - we still reset | ||||||||||
| // We assume its safe since all consecutive commits will fail | ||||||||||
| if result.is_err() || is_undelegate { | ||||||||||
| self.task_info_fetcher.reset(ResetType::Specific(&pubkeys)); | ||||||||||
| } | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.