Skip to content

Commit 230abd8

Browse files
committed
refactor: Simplify Task types
1 parent a58c61d commit 230abd8

File tree

17 files changed

+845
-943
lines changed

17 files changed

+845
-943
lines changed

magicblock-committor-service/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ IntentExecutor - responsible for execution of Intent. Calls **TransactionPrepar
2323
TransactionPreparator - is an entity that handles all of the above "Transaction preparation" calling **TaskBuilderV1**, **TaskStrategist**, **DeliveryPreparator** and then assempling it all and passing to **MessageExecutor**
2424

2525
## DeliveryPreparator
26-
After our **BaseTask**s are ready we need to prepare eveything for their successful execution. **DeliveryPreparator** - handles ALTs and commit buffers
26+
After our **DlpTask**s are ready we need to prepare eveything for their successful execution. **DeliveryPreparator** - handles ALTs and commit buffers
2727

2828
## TaskBuilder
2929
First, lets build atomic tasks from scheduled message/intent.
3030

31-
High level: TaskBuilder responsible for creating BaseTasks(to be renamed...) from ScheduledBaseIntent(to be renamed...).
31+
High level: TaskBuilder responsible for creating DlpTasks(to be renamed...) from ScheduledBaseIntent(to be renamed...).
3232
Details: To do that is requires additional information from DelegationMetadata, it is provided **CommitIdFetcher**
3333

34-
### BaseTask
35-
High level: BaseTask - is an atomic operation that is to be performed on the Base layer, like: Commit, Undelegate, Finalize, Action.
34+
### DlpTask
35+
High level: DlpTask - is an atomic operation that is to be performed on the Base layer, like: Commit, Undelegate, Finalize, Action.
3636

37-
Details: There's to implementation of BaseTask: ArgsTask, BufferTask. ArgsTask - gives instruction using args. BufferTask - gives instruction using buffer. BufferTask at the moment supports only commits
37+
Details: There's to implementation of DlpTask: ArgsTask, BufferTask. ArgsTask - gives instruction using args. BufferTask - gives instruction using buffer. BufferTask at the moment supports only commits
3838

3939
### TaskInfoFetcher
4040
High level: for account to be accepted by `dlp` it needs to have incremental commit ids. TaskInfoFetcher provides a user with the correct ids/nonces for set of committees

magicblock-committor-service/src/intent_executor/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use solana_sdk::{
1111

1212
use crate::{
1313
tasks::{
14-
task_builder::TaskBuilderError, task_strategist::TaskStrategistError,
15-
BaseTask, TaskType,
14+
dlp_task::DlpTask, task_builder::TaskBuilderError,
15+
task_strategist::TaskStrategistError, TaskType,
1616
},
1717
transaction_preparator::error::TransactionPreparatorError,
1818
};
@@ -138,7 +138,7 @@ impl TransactionStrategyExecutionError {
138138
pub fn try_from_transaction_error(
139139
err: TransactionError,
140140
signature: Option<Signature>,
141-
tasks: &[Box<dyn BaseTask>],
141+
tasks: &[DlpTask],
142142
) -> Result<Self, TransactionError> {
143143
// There's always 2 budget instructions in front
144144
const OFFSET: u8 = 2;
@@ -196,7 +196,7 @@ impl TransactionStrategyExecutionError {
196196
}
197197

198198
pub(crate) struct IntentTransactionErrorMapper<'a> {
199-
pub tasks: &'a [Box<dyn BaseTask>],
199+
pub tasks: &'a [DlpTask],
200200
}
201201
impl TransactionErrorMapper for IntentTransactionErrorMapper<'_> {
202202
type ExecutionError = TransactionStrategyExecutionError;

magicblock-committor-service/src/intent_executor/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ use crate::{
4343
},
4444
persist::{CommitStatus, CommitStatusSignatures, IntentPersister},
4545
tasks::{
46+
dlp_task::DlpTask,
4647
task_builder::{TaskBuilderError, TaskBuilderImpl, TasksBuilder},
4748
task_strategist::{
4849
TaskStrategist, TaskStrategistError, TransactionStrategy,
4950
},
5051
task_visitors::utility_visitor::TaskVisitorUtils,
51-
BaseTask, TaskType,
52+
TaskType,
5253
},
5354
transaction_preparator::{
5455
error::TransactionPreparatorError, TransactionPreparator,
@@ -122,8 +123,8 @@ where
122123
/// Checks if it is possible to unite Commit & Finalize stages in 1 transaction
123124
/// Returns corresponding `TransactionStrategy` if possible, otherwise `None`
124125
fn try_unite_tasks<P: IntentPersister>(
125-
commit_tasks: &[Box<dyn BaseTask>],
126-
finalize_task: &[Box<dyn BaseTask>],
126+
commit_tasks: &[DlpTask],
127+
finalize_task: &[DlpTask],
127128
authority: &Pubkey,
128129
persister: &Option<P>,
129130
) -> Result<Option<TransactionStrategy>, SignerError> {
@@ -621,7 +622,7 @@ where
621622
async fn execute_message_with_retries(
622623
&self,
623624
prepared_message: VersionedMessage,
624-
tasks: &[Box<dyn BaseTask>],
625+
tasks: &[DlpTask],
625626
) -> IntentExecutorResult<Signature, TransactionStrategyExecutionError>
626627
{
627628
struct IntentErrorMapper<TxMap> {

magicblock-committor-service/src/tasks/args_task.rs

Lines changed: 0 additions & 154 deletions
This file was deleted.

0 commit comments

Comments
 (0)