@@ -362,7 +362,7 @@ impl SubnetManager for EthSubnetManager {
362362
363363 let pending_tx = txn. send ( ) . await ?;
364364 let receipt = pending_tx. retries ( TRANSACTION_RECEIPT_RETRIES ) . await ?;
365- block_number_from_receipt ( receipt)
365+ block_number_from_positive_receipt ( receipt)
366366 }
367367
368368 async fn pre_fund ( & self , subnet : SubnetID , from : Address , balance : TokenAmount ) -> Result < ( ) > {
@@ -575,7 +575,7 @@ impl SubnetManager for EthSubnetManager {
575575
576576 let pending_tx = txn. send ( ) . await ?;
577577 let receipt = pending_tx. retries ( TRANSACTION_RECEIPT_RETRIES ) . await ?;
578- block_number_from_receipt ( receipt)
578+ block_number_from_positive_receipt ( receipt)
579579 }
580580
581581 /// Approves the `from` address to use up to `amount` tokens from `token_address`.
@@ -609,7 +609,7 @@ impl SubnetManager for EthSubnetManager {
609609
610610 let pending_tx = txn. send ( ) . await ?;
611611 let receipt = pending_tx. retries ( TRANSACTION_RECEIPT_RETRIES ) . await ?;
612- block_number_from_receipt ( receipt)
612+ block_number_from_positive_receipt ( receipt)
613613 }
614614
615615 async fn fund_with_token (
@@ -641,7 +641,7 @@ impl SubnetManager for EthSubnetManager {
641641
642642 let pending_tx = txn. send ( ) . await ?;
643643 let receipt = pending_tx. retries ( TRANSACTION_RECEIPT_RETRIES ) . await ?;
644- block_number_from_receipt ( receipt)
644+ block_number_from_positive_receipt ( receipt)
645645 }
646646
647647 async fn release (
@@ -671,7 +671,7 @@ impl SubnetManager for EthSubnetManager {
671671
672672 let pending_tx = txn. send ( ) . await ?;
673673 let receipt = pending_tx. retries ( TRANSACTION_RECEIPT_RETRIES ) . await ?;
674- block_number_from_receipt ( receipt)
674+ block_number_from_positive_receipt ( receipt)
675675 }
676676
677677 /// Send value between two addresses in a subnet
@@ -926,7 +926,7 @@ impl SubnetManager for EthSubnetManager {
926926 let txn = extend_call_with_pending_block ( call) . await ?;
927927 let pending_tx = txn. send ( ) . await ?;
928928 let receipt = pending_tx. retries ( TRANSACTION_RECEIPT_RETRIES ) . await ?;
929- block_number_from_receipt ( receipt)
929+ block_number_from_positive_receipt ( receipt)
930930 }
931931}
932932
@@ -1210,7 +1210,7 @@ impl BottomUpCheckpointRelayer for EthSubnetManager {
12101210
12111211 let receipt = pending_tx. retries ( TRANSACTION_RECEIPT_RETRIES ) . await ?;
12121212
1213- block_number_from_receipt ( receipt)
1213+ block_number_from_positive_receipt ( receipt)
12141214 }
12151215
12161216 async fn last_bottom_up_checkpoint_height (
@@ -1510,15 +1510,21 @@ where
15101510}
15111511
15121512/// Get the block number from the transaction receipt
1513- fn block_number_from_receipt (
1513+ fn block_number_from_positive_receipt (
15141514 receipt : Option < ethers:: types:: TransactionReceipt > ,
15151515) -> Result < ChainEpoch > {
15161516 match receipt {
1517- Some ( r) => {
1517+ Some ( r) =>
1518+ // success only
1519+ if r. status . as_ref ( ) . map ( |x| x. as_u64 ( ) ) != Some ( 1 ) {
15181520 let block_number = r
15191521 . block_number
15201522 . ok_or_else ( || anyhow ! ( "cannot get block number" ) ) ?;
15211523 Ok ( block_number. as_u64 ( ) as ChainEpoch )
1524+ } else {
1525+ Err ( anyhow ! (
1526+ "txn sent to network, but receipt was a revert receipt"
1527+ ) )
15221528 }
15231529 None => Err ( anyhow ! (
15241530 "txn sent to network, but receipt cannot be obtained, please check scanner"
0 commit comments