@@ -27,7 +27,6 @@ use crate::{
2727#[ derive( Clone ) ]
2828pub enum ArgsTaskType {
2929 Commit ( CommitTask ) ,
30- CommitDiff ( CommitTask ) ,
3130 Finalize ( FinalizeTask ) ,
3231 Undelegate ( UndelegateTask ) , // Special action really
3332 BaseAction ( BaseActionTask ) ,
@@ -71,55 +70,55 @@ impl BaseTask for ArgsTask {
7170 args,
7271 )
7372 }
74- ArgsTaskType :: CommitDiff ( value) => {
75- let chain_config =
76- ChainConfig :: local ( ComputeBudgetConfig :: new ( 1_000_000 ) ) ;
77-
78- let rpc_client = RpcClient :: new_with_commitment (
79- chain_config. rpc_uri . to_string ( ) ,
80- CommitmentConfig {
81- commitment : chain_config. commitment ,
82- } ,
83- ) ;
84-
85- let account = match rpc_client
86- . get_account ( & value. committed_account . pubkey )
87- {
88- Ok ( account) => account,
89- Err ( e) => {
90- log:: warn!( "Fallback to commit_state and send full-bytes, as rpc failed to fetch the delegated-account from base chain, commmit_id: {} , error: {}" , value. commit_id, e) ;
91- let args = CommitStateArgs {
92- nonce : value. commit_id ,
93- lamports : value. committed_account . account . lamports ,
94- data : value. committed_account . account . data . clone ( ) ,
95- allow_undelegation : value. allow_undelegation ,
96- } ;
97- return dlp:: instruction_builder:: commit_state (
98- * validator,
99- value. committed_account . pubkey ,
100- value. committed_account . account . owner ,
101- args,
102- ) ;
103- }
104- } ;
105-
106- let args = CommitDiffArgs {
107- nonce : value. commit_id ,
108- lamports : value. committed_account . account . lamports ,
109- diff : compute_diff (
110- account. data ( ) ,
111- value. committed_account . account . data ( ) ,
112- )
113- . to_vec ( ) ,
114- allow_undelegation : value. allow_undelegation ,
115- } ;
116- dlp:: instruction_builder:: commit_diff (
117- * validator,
118- value. committed_account . pubkey ,
119- value. committed_account . account . owner ,
120- args,
121- )
122- }
73+ // ArgsTaskType::CommitDiff(value) => {
74+ // let chain_config =
75+ // ChainConfig::local(ComputeBudgetConfig::new(1_000_000));
76+
77+ // let rpc_client = RpcClient::new_with_commitment(
78+ // chain_config.rpc_uri.to_string(),
79+ // CommitmentConfig {
80+ // commitment: chain_config.commitment,
81+ // },
82+ // );
83+
84+ // let account = match rpc_client
85+ // .get_account(&value.committed_account.pubkey)
86+ // {
87+ // Ok(account) => account,
88+ // Err(e) => {
89+ // log::warn!("Fallback to commit_state and send full-bytes, as rpc failed to fetch the delegated-account from base chain, commmit_id: {} , error: {}", value.commit_id, e);
90+ // let args = CommitStateArgs {
91+ // nonce: value.commit_id,
92+ // lamports: value.committed_account.account.lamports,
93+ // data: value.committed_account.account.data.clone(),
94+ // allow_undelegation: value.allow_undelegation,
95+ // };
96+ // return dlp::instruction_builder::commit_state(
97+ // *validator,
98+ // value.committed_account.pubkey,
99+ // value.committed_account.account.owner,
100+ // args,
101+ // );
102+ // }
103+ // };
104+
105+ // let args = CommitDiffArgs {
106+ // nonce: value.commit_id,
107+ // lamports: value.committed_account.account.lamports,
108+ // diff: compute_diff(
109+ // account.data(),
110+ // value.committed_account.account.data(),
111+ // )
112+ // .to_vec(),
113+ // allow_undelegation: value.allow_undelegation,
114+ // };
115+ // dlp::instruction_builder::commit_diff(
116+ // *validator,
117+ // value.committed_account.pubkey,
118+ // value.committed_account.account.owner,
119+ // args,
120+ // )
121+ // }
123122 ArgsTaskType :: Finalize ( value) => {
124123 dlp:: instruction_builder:: finalize (
125124 * validator,
@@ -168,8 +167,6 @@ impl BaseTask for ArgsTask {
168167 BufferTaskType :: Commit ( value) ,
169168 ) ) )
170169 }
171- // TODO (snawaz): discuss this with reviewers
172- ArgsTaskType :: CommitDiff ( _) => Err ( self ) ,
173170 ArgsTaskType :: BaseAction ( _)
174171 | ArgsTaskType :: Finalize ( _)
175172 | ArgsTaskType :: Undelegate ( _) => Err ( self ) ,
@@ -196,7 +193,6 @@ impl BaseTask for ArgsTask {
196193 fn compute_units ( & self ) -> u32 {
197194 match & self . task_type {
198195 ArgsTaskType :: Commit ( _) => 70_000 ,
199- ArgsTaskType :: CommitDiff ( _) => 65_000 ,
200196 ArgsTaskType :: BaseAction ( task) => task. action . compute_units ,
201197 ArgsTaskType :: Undelegate ( _) => 70_000 ,
202198 ArgsTaskType :: Finalize ( _) => 70_000 ,
@@ -211,9 +207,6 @@ impl BaseTask for ArgsTask {
211207 fn task_type ( & self ) -> TaskType {
212208 match & self . task_type {
213209 ArgsTaskType :: Commit ( _) => TaskType :: Commit ,
214- // TODO (snawaz): What should we use here? Commit (in the sense of "category of task"), or add a
215- // new variant "CommitDiff" to indicate a specific instruction?
216- ArgsTaskType :: CommitDiff ( _) => TaskType :: Commit ,
217210 ArgsTaskType :: BaseAction ( _) => TaskType :: Action ,
218211 ArgsTaskType :: Undelegate ( _) => TaskType :: Undelegate ,
219212 ArgsTaskType :: Finalize ( _) => TaskType :: Finalize ,
@@ -226,7 +219,6 @@ impl BaseTask for ArgsTask {
226219 }
227220
228221 fn reset_commit_id ( & mut self , commit_id : u64 ) {
229- // TODO (snawaz): handle CommitDiff as well? what is it about?
230222 let ArgsTaskType :: Commit ( commit_task) = & mut self . task_type else {
231223 return ;
232224 } ;
0 commit comments