@@ -43,7 +43,7 @@ impl MonzaExecutor for MonzaExecutorV1 {
43
43
/// Executes a block dynamically
44
44
async fn execute_block (
45
45
& self ,
46
- mode : & FinalityMode ,
46
+ mode : FinalityMode ,
47
47
block : ExecutableBlock ,
48
48
) -> Result < ( ) , anyhow:: Error > {
49
49
match mode {
@@ -57,19 +57,18 @@ impl MonzaExecutor for MonzaExecutorV1 {
57
57
}
58
58
59
59
/// Sets the transaction channel.
60
- async fn set_tx_channel (
60
+ fn set_tx_channel (
61
61
& mut self ,
62
62
tx_channel : Sender < SignedTransaction > ,
63
- ) -> Result < ( ) , anyhow :: Error > {
63
+ ) {
64
64
self . transaction_channel = tx_channel;
65
- Ok ( ( ) )
66
65
}
67
66
68
67
/// Gets the API.
69
- async fn get_api ( & self , _mode : & FinalityMode ) -> Result < Apis , anyhow :: Error > {
70
- match _mode {
68
+ fn get_api ( & self , mode : FinalityMode ) -> Apis {
69
+ match mode {
71
70
FinalityMode :: Dyn => unimplemented ! ( ) ,
72
- FinalityMode :: Opt => Ok ( self . executor . try_get_apis ( ) . await ? ) ,
71
+ FinalityMode :: Opt => self . executor . get_apis ( ) ,
73
72
FinalityMode :: Fin => unimplemented ! ( ) ,
74
73
}
75
74
}
@@ -131,15 +130,15 @@ mod tests {
131
130
132
131
#[ tokio:: test]
133
132
async fn test_execute_opt_block ( ) -> Result < ( ) , anyhow:: Error > {
134
- let ( tx, rx ) = async_channel:: unbounded ( ) ;
135
- let mut executor = MonzaExecutorV1 :: try_from_env ( tx) . await ?;
133
+ let ( tx, _rx ) = async_channel:: unbounded ( ) ;
134
+ let executor = MonzaExecutorV1 :: try_from_env ( tx) . await ?;
136
135
let block_id = HashValue :: random ( ) ;
137
136
let tx = SignatureVerifiedTransaction :: Valid ( Transaction :: UserTransaction (
138
137
create_signed_transaction ( 0 ) ,
139
138
) ) ;
140
139
let txs = ExecutableTransactions :: Unsharded ( vec ! [ tx] ) ;
141
140
let block = ExecutableBlock :: new ( block_id. clone ( ) , txs) ;
142
- executor. execute_block ( & FinalityMode :: Opt , block) . await ?;
141
+ executor. execute_block ( FinalityMode :: Opt , block) . await ?;
143
142
Ok ( ( ) )
144
143
}
145
144
@@ -166,7 +165,7 @@ mod tests {
166
165
let bcs_user_transaction = bcs:: to_bytes ( & user_transaction) ?;
167
166
168
167
let request = SubmitTransactionPost :: Bcs ( aptos_api:: bcs_payload:: Bcs ( bcs_user_transaction) ) ;
169
- let api = executor. get_api ( & FinalityMode :: Opt ) . await ? ;
168
+ let api = executor. get_api ( FinalityMode :: Opt ) ;
170
169
api. transactions . submit_transaction ( AcceptType :: Bcs , request) . await ?;
171
170
172
171
services_handle. abort ( ) ;
@@ -200,7 +199,7 @@ mod tests {
200
199
let bcs_user_transaction = bcs:: to_bytes ( & user_transaction) ?;
201
200
202
201
let request = SubmitTransactionPost :: Bcs ( aptos_api:: bcs_payload:: Bcs ( bcs_user_transaction) ) ;
203
- let api = executor. get_api ( & FinalityMode :: Opt ) . await ? ;
202
+ let api = executor. get_api ( FinalityMode :: Opt ) ;
204
203
api. transactions . submit_transaction ( AcceptType :: Bcs , request) . await ?;
205
204
206
205
let received_transaction = rx. recv ( ) . await ?;
@@ -212,7 +211,7 @@ mod tests {
212
211
SignatureVerifiedTransaction :: Valid ( Transaction :: UserTransaction ( received_transaction) ) ;
213
212
let txs = ExecutableTransactions :: Unsharded ( vec ! [ tx] ) ;
214
213
let block = ExecutableBlock :: new ( block_id. clone ( ) , txs) ;
215
- executor. execute_block ( & FinalityMode :: Opt , block) . await ?;
214
+ executor. execute_block ( FinalityMode :: Opt , block) . await ?;
216
215
217
216
services_handle. abort ( ) ;
218
217
background_handle. abort ( ) ;
@@ -261,7 +260,7 @@ mod tests {
261
260
262
261
let request =
263
262
SubmitTransactionPost :: Bcs ( aptos_api:: bcs_payload:: Bcs ( bcs_user_transaction) ) ;
264
- let api = executor. get_api ( & FinalityMode :: Opt ) . await ? ;
263
+ let api = executor. get_api ( FinalityMode :: Opt ) ;
265
264
api. transactions . submit_transaction ( AcceptType :: Bcs , request) . await ?;
266
265
267
266
let received_transaction = rx. recv ( ) . await ?;
@@ -274,7 +273,7 @@ mod tests {
274
273
) ) ;
275
274
let txs = ExecutableTransactions :: Unsharded ( vec ! [ tx] ) ;
276
275
let block = ExecutableBlock :: new ( block_id. clone ( ) , txs) ;
277
- executor. execute_block ( & FinalityMode :: Opt , block) . await ?;
276
+ executor. execute_block ( FinalityMode :: Opt , block) . await ?;
278
277
279
278
blockheight += 1 ;
280
279
committed_blocks. insert (
@@ -369,7 +368,7 @@ mod tests {
369
368
executor. execute_block ( block) . await ?;
370
369
371
370
// Retrieve the executor's API interface and fetch the transaction by each hash.
372
- let apis = executor. try_get_apis ( ) . await ? ;
371
+ let apis = executor. get_apis ( ) ;
373
372
for hash in transaction_hashes {
374
373
let _ = apis
375
374
. transactions
0 commit comments