@@ -5,7 +5,6 @@ use solana_sdk::hash::Hash;
55
66use solana_sdk:: transaction:: SanitizedTransaction ;
77use solana_sdk:: transaction:: Transaction ;
8- use solana_sdk:: transaction:: TransactionError ;
98
109use solana_svm:: account_loader:: CheckedTransactionDetails ;
1110use solana_svm:: transaction_processor:: ExecutionRecordingConfig ;
@@ -74,7 +73,7 @@ impl TridentSVM {
7473 pub fn process_transaction_with_settle (
7574 & mut self ,
7675 transaction : Transaction ,
77- ) -> solana_sdk :: transaction :: Result < ( ) > {
76+ ) -> LoadAndExecuteSanitizedTransactionsOutput {
7877 let fee_structure = FeeStructure :: default ( ) ;
7978 let lamports_per_signature = fee_structure. lamports_per_signature ;
8079
@@ -115,7 +114,8 @@ impl TridentSVM {
115114
116115 // create sanitized transaction
117116 let sanitezed_tx =
118- SanitizedTransaction :: try_from_legacy_transaction ( transaction, & HashSet :: new ( ) ) ?;
117+ SanitizedTransaction :: try_from_legacy_transaction ( transaction, & HashSet :: new ( ) )
118+ . expect ( "Trident SVM is not able to create sanitized transaction" ) ;
119119
120120 // get fee structure
121121 let fee_structure = FeeStructure :: default ( ) ;
@@ -130,38 +130,28 @@ impl TridentSVM {
130130 & tx_processing_config,
131131 ) ;
132132
133- // TODO: Check why there is vector of Transaction results
134- // We process only one transaction here, so it might possible be always 1 ?
135- // TODO: Check if this is correct way to check if transaction was executed, potentially
136- // add support to process the whole vector
137- let execution_result = if result. execution_results . len ( ) != 1 {
138- return Err ( TransactionError :: ProgramCacheHitMaxLimit ) ;
139- } else {
140- & result. execution_results [ 0 ]
141- } ;
142-
143- match & execution_result {
133+ match & result. execution_results [ 0 ] {
144134 solana_svm:: transaction_results:: TransactionExecutionResult :: Executed {
145135 details,
146136 ..
147- } => {
148- details
149- . status
150- . as_ref ( )
151- . map_err ( |transaction_error| transaction_error. clone ( ) ) ?;
152-
153- match & result. loaded_transactions [ 0 ] {
137+ } => match & details. status {
138+ Ok ( ( ) ) => match & result. loaded_transactions [ 0 ] {
154139 Ok ( loaded_transaction) => {
155140 self . settle_accounts ( & loaded_transaction. accounts ) ;
156- Ok ( ( ) )
157141 }
158- Err ( transaction_error) => Err ( transaction_error. clone ( ) ) ,
142+ Err ( _) => { }
143+ } ,
144+ Err ( _transaction_error) => {
145+ // in case of transaction error, we don't need to do anything
159146 }
160- }
147+ } ,
161148 solana_svm:: transaction_results:: TransactionExecutionResult :: NotExecuted (
162- transaction_error,
163- ) => Err ( transaction_error. clone ( ) ) ,
149+ _transaction_error,
150+ ) => {
151+ // in case of transaction error, we don't need to do anything
152+ }
164153 }
154+ result
165155 }
166156}
167157
0 commit comments