@@ -179,8 +179,8 @@ mod tests {
179179 let mut heap = BytesHeap :: new ( API_VERSION_0_0_5 ) ;
180180 let trigger = NearTrigger :: Receipt ( Arc :: new ( ReceiptWithOutcome {
181181 block : Arc :: new ( block ( ) ) ,
182- outcome : execution_outcome_with_id ( ) . unwrap ( ) ,
183- receipt : receipt ( ) . unwrap ( ) ,
182+ outcome : execution_outcome_with_id ( ) ,
183+ receipt : receipt ( ) ,
184184 } ) ) ;
185185
186186 let result = trigger
@@ -195,78 +195,78 @@ mod tests {
195195 header : Some ( codec:: BlockHeader {
196196 height : 2 ,
197197 prev_height : 1 ,
198- epoch_id : hash ( "01" ) ,
199- next_epoch_id : hash ( "02" ) ,
200- hash : hash ( "01" ) ,
201- prev_hash : hash ( "00" ) ,
202- prev_state_root : hash ( "bb00010203" ) ,
203- chunk_receipts_root : hash ( "bb00010203" ) ,
204- chunk_headers_root : hash ( "bb00010203" ) ,
205- chunk_tx_root : hash ( "bb00010203" ) ,
206- outcome_root : hash ( "cc00010203" ) ,
198+ epoch_id : Some ( hash ( "01" ) ) ,
199+ next_epoch_id : Some ( hash ( "02" ) ) ,
200+ hash : Some ( hash ( "01" ) ) ,
201+ prev_hash : Some ( hash ( "00" ) ) ,
202+ prev_state_root : Some ( hash ( "bb00010203" ) ) ,
203+ chunk_receipts_root : Some ( hash ( "bb00010203" ) ) ,
204+ chunk_headers_root : Some ( hash ( "bb00010203" ) ) ,
205+ chunk_tx_root : Some ( hash ( "bb00010203" ) ) ,
206+ outcome_root : Some ( hash ( "cc00010203" ) ) ,
207207 chunks_included : 1 ,
208- challenges_root : hash ( "aa" ) ,
208+ challenges_root : Some ( hash ( "aa" ) ) ,
209209 timestamp : 100 ,
210210 timestamp_nanosec : 0 ,
211- random_value : hash ( "010203" ) ,
211+ random_value : Some ( hash ( "010203" ) ) ,
212212 validator_proposals : vec ! [ ] ,
213213 chunk_mask : vec ! [ ] ,
214- gas_price : big_int ( 10 ) ,
214+ gas_price : Some ( big_int ( 10 ) ) ,
215215 block_ordinal : 0 ,
216- total_supply : big_int ( 1_000 ) ,
216+ total_supply : Some ( big_int ( 1_000 ) ) ,
217217 challenges_result : vec ! [ ] ,
218- last_final_block : hash ( "00" ) ,
218+ last_final_block : Some ( hash ( "00" ) ) ,
219219 last_final_block_height : 0 ,
220- last_ds_final_block : hash ( "00" ) ,
220+ last_ds_final_block : Some ( hash ( "00" ) ) ,
221221 last_ds_final_block_height : 0 ,
222- next_bp_hash : hash ( "bb" ) ,
223- block_merkle_root : hash ( "aa" ) ,
222+ next_bp_hash : Some ( hash ( "bb" ) ) ,
223+ block_merkle_root : Some ( hash ( "aa" ) ) ,
224224 epoch_sync_data_hash : vec ! [ 0x00 , 0x01 ] ,
225225 approvals : vec ! [ ] ,
226- signature : signature ( "00" ) ,
226+ signature : Some ( signature ( "00" ) ) ,
227227 latest_protocol_version : 0 ,
228228 } ) ,
229- chunk_headers : vec ! [ chunk_header( ) . unwrap ( ) ] ,
229+ chunk_headers : vec ! [ chunk_header( ) ] ,
230230 shards : vec ! [ codec:: IndexerShard {
231231 shard_id: 0 ,
232232 chunk: Some ( codec:: IndexerChunk {
233233 author: "near" . to_string( ) ,
234- header: chunk_header( ) ,
234+ header: Some ( chunk_header( ) ) ,
235235 transactions: vec![ codec:: IndexerTransactionWithOutcome {
236236 transaction: Some ( codec:: SignedTransaction {
237237 signer_id: "signer" . to_string( ) ,
238- public_key: public_key( "aabb" ) ,
238+ public_key: Some ( public_key( "aabb" ) ) ,
239239 nonce: 1 ,
240240 receiver_id: "receiver" . to_string( ) ,
241241 actions: vec![ ] ,
242- signature: signature( "ff" ) ,
243- hash: hash( "bb" ) ,
242+ signature: Some ( signature( "ff" ) ) ,
243+ hash: Some ( hash( "bb" ) ) ,
244244 } ) ,
245245 outcome: Some ( codec:: IndexerExecutionOutcomeWithOptionalReceipt {
246- execution_outcome: execution_outcome_with_id( ) ,
247- receipt: receipt( ) ,
246+ execution_outcome: Some ( execution_outcome_with_id( ) ) ,
247+ receipt: Some ( receipt( ) ) ,
248248 } ) ,
249249 } ] ,
250- receipts: vec![ receipt( ) . unwrap ( ) ] ,
250+ receipts: vec![ receipt( ) ] ,
251251 } ) ,
252252 receipt_execution_outcomes: vec![ codec:: IndexerExecutionOutcomeWithReceipt {
253- execution_outcome: execution_outcome_with_id( ) ,
254- receipt: receipt( ) ,
253+ execution_outcome: Some ( execution_outcome_with_id( ) ) ,
254+ receipt: Some ( receipt( ) ) ,
255255 } ] ,
256256 } ] ,
257257 state_changes : vec ! [ ] ,
258258 }
259259 }
260260
261- fn receipt ( ) -> Option < codec:: Receipt > {
262- Some ( codec:: Receipt {
261+ fn receipt ( ) -> codec:: Receipt {
262+ codec:: Receipt {
263263 predecessor_id : "genesis.near" . to_string ( ) ,
264264 receiver_id : "near" . to_string ( ) ,
265- receipt_id : hash ( "dead" ) ,
265+ receipt_id : Some ( hash ( "dead" ) ) ,
266266 receipt : Some ( codec:: receipt:: Receipt :: Action ( codec:: ReceiptAction {
267267 signer_id : "near" . to_string ( ) ,
268- signer_public_key : public_key ( "aa" ) ,
269- gas_price : big_int ( 2 ) ,
268+ signer_public_key : Some ( public_key ( "aa" ) ) ,
269+ gas_price : Some ( big_int ( 2 ) ) ,
270270 output_data_receivers : vec ! [ ] ,
271271 input_data_ids : vec ! [ ] ,
272272 actions : vec ! [
@@ -288,24 +288,24 @@ mod tests {
288288 method_name: "func" . to_string( ) ,
289289 args: vec![ 0x01 , 0x02 ] ,
290290 gas: 1000 ,
291- deposit: big_int( 100 ) ,
291+ deposit: Some ( big_int( 100 ) ) ,
292292 } ,
293293 ) ) ,
294294 } ,
295295 codec:: Action {
296296 action: Some ( codec:: action:: Action :: Transfer ( codec:: TransferAction {
297- deposit: big_int( 100 ) ,
297+ deposit: Some ( big_int( 100 ) ) ,
298298 } ) ) ,
299299 } ,
300300 codec:: Action {
301301 action: Some ( codec:: action:: Action :: Stake ( codec:: StakeAction {
302- stake: big_int( 100 ) ,
303- public_key: public_key( "aa" ) ,
302+ stake: Some ( big_int( 100 ) ) ,
303+ public_key: Some ( public_key( "aa" ) ) ,
304304 } ) ) ,
305305 } ,
306306 codec:: Action {
307307 action: Some ( codec:: action:: Action :: AddKey ( codec:: AddKeyAction {
308- public_key: public_key( "aa" ) ,
308+ public_key: Some ( public_key( "aa" ) ) ,
309309 access_key: Some ( codec:: AccessKey {
310310 nonce: 1 ,
311311 permission: Some ( codec:: AccessKeyPermission {
@@ -325,7 +325,7 @@ mod tests {
325325 } ,
326326 codec:: Action {
327327 action: Some ( codec:: action:: Action :: AddKey ( codec:: AddKeyAction {
328- public_key: public_key( "aa" ) ,
328+ public_key: Some ( public_key( "aa" ) ) ,
329329 access_key: Some ( codec:: AccessKey {
330330 nonce: 1 ,
331331 permission: Some ( codec:: AccessKeyPermission {
@@ -340,7 +340,7 @@ mod tests {
340340 } ,
341341 codec:: Action {
342342 action: Some ( codec:: action:: Action :: DeleteKey ( codec:: DeleteKeyAction {
343- public_key: public_key( "aa" ) ,
343+ public_key: Some ( public_key( "aa" ) ) ,
344344 } ) ) ,
345345 } ,
346346 codec:: Action {
@@ -352,11 +352,11 @@ mod tests {
352352 } ,
353353 ] ,
354354 } ) ) ,
355- } )
355+ }
356356 }
357357
358- fn chunk_header ( ) -> Option < codec:: ChunkHeader > {
359- Some ( codec:: ChunkHeader {
358+ fn chunk_header ( ) -> codec:: ChunkHeader {
359+ codec:: ChunkHeader {
360360 chunk_hash : vec ! [ 0x00 ] ,
361361 prev_block_hash : vec ! [ 0x01 ] ,
362362 outcome_root : vec ! [ 0x02 ] ,
@@ -368,69 +368,69 @@ mod tests {
368368 shard_id : 4 ,
369369 gas_used : 5 ,
370370 gas_limit : 6 ,
371- validator_reward : big_int ( 7 ) ,
372- balance_burnt : big_int ( 7 ) ,
371+ validator_reward : Some ( big_int ( 7 ) ) ,
372+ balance_burnt : Some ( big_int ( 7 ) ) ,
373373 outgoing_receipts_root : vec ! [ 0x07 ] ,
374374 tx_root : vec ! [ 0x08 ] ,
375375 validator_proposals : vec ! [ codec:: ValidatorStake {
376376 account_id: "account" . to_string( ) ,
377- public_key: public_key( "aa" ) ,
378- stake: big_int( 10 ) ,
377+ public_key: Some ( public_key( "aa" ) ) ,
378+ stake: Some ( big_int( 10 ) ) ,
379379 } ] ,
380- signature : signature ( "ff" ) ,
381- } )
380+ signature : Some ( signature ( "ff" ) ) ,
381+ }
382382 }
383383
384- fn execution_outcome_with_id ( ) -> Option < codec:: ExecutionOutcomeWithId > {
385- Some ( codec:: ExecutionOutcomeWithId {
384+ fn execution_outcome_with_id ( ) -> codec:: ExecutionOutcomeWithId {
385+ codec:: ExecutionOutcomeWithId {
386386 proof : Some ( codec:: MerklePath { path : vec ! [ ] } ) ,
387- block_hash : hash ( "aa" ) ,
388- id : hash ( "beef" ) ,
389- outcome : execution_outcome ( ) ,
390- } )
387+ block_hash : Some ( hash ( "aa" ) ) ,
388+ id : Some ( hash ( "beef" ) ) ,
389+ outcome : Some ( execution_outcome ( ) ) ,
390+ }
391391 }
392392
393- fn execution_outcome ( ) -> Option < codec:: ExecutionOutcome > {
394- Some ( codec:: ExecutionOutcome {
393+ fn execution_outcome ( ) -> codec:: ExecutionOutcome {
394+ codec:: ExecutionOutcome {
395395 logs : vec ! [ "string" . to_string( ) ] ,
396396 receipt_ids : vec ! [ ] ,
397397 gas_burnt : 1 ,
398- tokens_burnt : big_int ( 2 ) ,
398+ tokens_burnt : Some ( big_int ( 2 ) ) ,
399399 executor_id : "near" . to_string ( ) ,
400400 metadata : 0 ,
401401 status : Some ( codec:: execution_outcome:: Status :: SuccessValue (
402402 codec:: SuccessValueExecutionStatus { value : vec ! [ 0x00 ] } ,
403403 ) ) ,
404- } )
404+ }
405405 }
406406
407- fn big_int ( input : u64 ) -> Option < codec:: BigInt > {
407+ fn big_int ( input : u64 ) -> codec:: BigInt {
408408 let value = BigInt :: from ( input) ;
409409 let bytes = value. to_signed_bytes_le ( ) ;
410410
411- Some ( codec:: BigInt { bytes } )
411+ codec:: BigInt { bytes }
412412 }
413413
414- fn hash ( input : & str ) -> Option < codec:: CryptoHash > {
415- Some ( codec:: CryptoHash {
414+ fn hash ( input : & str ) -> codec:: CryptoHash {
415+ codec:: CryptoHash {
416416 bytes : hex:: decode ( input) . unwrap_or_else ( |_| panic ! ( "Invalid hash value {}" , input) ) ,
417- } )
417+ }
418418 }
419419
420- fn public_key ( input : & str ) -> Option < codec:: PublicKey > {
421- Some ( codec:: PublicKey {
420+ fn public_key ( input : & str ) -> codec:: PublicKey {
421+ codec:: PublicKey {
422422 r#type : 0 ,
423423 bytes : hex:: decode ( input)
424424 . unwrap_or_else ( |_| panic ! ( "Invalid PublicKey value {}" , input) ) ,
425- } )
425+ }
426426 }
427427
428- fn signature ( input : & str ) -> Option < codec:: Signature > {
429- Some ( codec:: Signature {
428+ fn signature ( input : & str ) -> codec:: Signature {
429+ codec:: Signature {
430430 r#type : 0 ,
431431 bytes : hex:: decode ( input)
432432 . unwrap_or_else ( |_| panic ! ( "Invalid Signature value {}" , input) ) ,
433- } )
433+ }
434434 }
435435
436436 struct BytesHeap {
0 commit comments