@@ -3058,29 +3058,25 @@ async fn test_end_to_end_repeated_transfers(config: impl LineraNetConfig) -> Res
3058
3058
// Make sure all incoming messages are processed, and get both chains' heights.
3059
3059
let mut next_height1 = {
3060
3060
let node_service1 = client1. run_node_service ( port1, ProcessInbox :: Skip ) . await ?;
3061
- node_service1. process_inbox ( & chain_id1) . await . unwrap ( ) ;
3061
+ node_service1. process_inbox ( & chain_id1) . await ? ;
3062
3062
let mut chain = node_service1
3063
3063
. query_node ( & format ! (
3064
3064
"query {{ chain(chainId: \" {chain_id1}\" ) {{ tipState {{ nextBlockHeight }} }} }}"
3065
3065
) )
3066
- . await
3067
- . unwrap ( ) ;
3068
- serde_json:: from_value :: < BlockHeight > ( chain[ "chain" ] [ "tipState" ] [ "nextBlockHeight" ] . take ( ) )
3069
- . unwrap ( )
3066
+ . await ?;
3067
+ serde_json:: from_value :: < BlockHeight > ( chain[ "chain" ] [ "tipState" ] [ "nextBlockHeight" ] . take ( ) ) ?
3070
3068
} ;
3071
3069
let mut next_height2 = {
3072
- node_service2. process_inbox ( & chain_id2) . await . unwrap ( ) ;
3070
+ node_service2. process_inbox ( & chain_id2) . await ? ;
3073
3071
let mut chain = node_service2
3074
3072
. query_node ( & format ! (
3075
3073
"query {{ chain(chainId: \" {chain_id2}\" ) {{ tipState {{ nextBlockHeight }} }} }}"
3076
3074
) )
3077
- . await
3078
- . unwrap ( ) ;
3079
- serde_json:: from_value :: < BlockHeight > ( chain[ "chain" ] [ "tipState" ] [ "nextBlockHeight" ] . take ( ) )
3080
- . unwrap ( )
3075
+ . await ?;
3076
+ serde_json:: from_value :: < BlockHeight > ( chain[ "chain" ] [ "tipState" ] [ "nextBlockHeight" ] . take ( ) ) ?
3081
3077
} ;
3082
3078
3083
- let mut notifications2 = Box :: pin ( node_service2. notifications ( chain_id2) . await . unwrap ( ) ) ;
3079
+ let mut notifications2 = Box :: pin ( node_service2. notifications ( chain_id2) . await ? ) ;
3084
3080
let mut block_duration = Duration :: ZERO ;
3085
3081
let mut message_duration = Duration :: ZERO ;
3086
3082
@@ -3089,8 +3085,7 @@ async fn test_end_to_end_repeated_transfers(config: impl LineraNetConfig) -> Res
3089
3085
let start_time = Instant :: now ( ) ;
3090
3086
client1
3091
3087
. transfer ( Amount :: from_attos ( 1 ) , chain_id1, chain_id2)
3092
- . await
3093
- . unwrap ( ) ;
3088
+ . await ?;
3094
3089
let mut got_message = false ;
3095
3090
3096
3091
// Wait until chain 2 created a block receiving the tokens.
@@ -3099,9 +3094,12 @@ async fn test_end_to_end_repeated_transfers(config: impl LineraNetConfig) -> Res
3099
3094
let duration = timeout. duration_since ( Instant :: now ( ) ) ;
3100
3095
let sleep = Box :: pin ( linera_base:: time:: timer:: sleep ( duration) ) ;
3101
3096
let reason = match future:: select ( notifications2. next ( ) , sleep) . await {
3102
- Either :: Right ( ( ( ) , _ ) ) | Either :: Left ( ( None , _) ) => {
3097
+ Either :: Left ( ( None , _) ) => {
3103
3098
panic ! ( "Failed to receive notification about transfer #{i}." ) ;
3104
3099
}
3100
+ Either :: Right ( ( ( ) , _) ) => {
3101
+ panic ! ( "Timeout to receive notification about transfer #{i}." ) ;
3102
+ }
3105
3103
Either :: Left ( ( Some ( Err ( error) ) , _) ) => {
3106
3104
panic ! ( "Error waiting for notification about transfer #{i}: {error}" ) ;
3107
3105
}
@@ -3117,7 +3115,10 @@ async fn test_end_to_end_repeated_transfers(config: impl LineraNetConfig) -> Res
3117
3115
assert_eq ! ( height, next_height1) ;
3118
3116
assert_eq ! ( origin. sender, chain_id1) ;
3119
3117
assert_eq ! ( origin. medium, Medium :: Direct ) ;
3120
- assert ! ( !got_message, "Duplicate message notification" ) ;
3118
+ assert ! (
3119
+ !got_message,
3120
+ "Duplicate message notification about transfer #{i}"
3121
+ ) ;
3121
3122
got_message = true ;
3122
3123
next_height1. 0 += 1 ;
3123
3124
if i >= WARMUP_ITERATIONS {
@@ -3126,14 +3127,19 @@ async fn test_end_to_end_repeated_transfers(config: impl LineraNetConfig) -> Res
3126
3127
}
3127
3128
Reason :: NewBlock { height, hash } => {
3128
3129
assert_eq ! ( height, next_height2) ;
3129
- assert ! ( got_message, "Missing message notification" ) ;
3130
+ assert ! (
3131
+ got_message,
3132
+ "Missing message notification about transfer #{i}"
3133
+ ) ;
3130
3134
next_height2. 0 += 1 ;
3131
3135
if i >= WARMUP_ITERATIONS {
3132
3136
block_duration += start_time. elapsed ( ) ;
3133
3137
}
3134
3138
break hash;
3135
3139
}
3136
- reason @ Reason :: NewRound { .. } => panic ! ( "Unexpected notification {reason:?}" ) ,
3140
+ reason @ Reason :: NewRound { .. } => {
3141
+ panic ! ( "Unexpected notification about transfer #{i} {reason:?}" )
3142
+ }
3137
3143
}
3138
3144
} ;
3139
3145
@@ -3146,15 +3152,14 @@ async fn test_end_to_end_repeated_transfers(config: impl LineraNetConfig) -> Res
3146
3152
}} }} }} }} \
3147
3153
}} }}"
3148
3154
) )
3149
- . await
3150
- . unwrap ( ) ;
3155
+ . await ?;
3151
3156
let mut bundle =
3152
3157
block2[ "block" ] [ "value" ] [ "executedBlock" ] [ "block" ] [ "incomingBundles" ] [ 0 ] . take ( ) ;
3153
- let origin = serde_json:: from_value :: < Origin > ( bundle[ "origin" ] . take ( ) ) . unwrap ( ) ;
3158
+ let origin = serde_json:: from_value :: < Origin > ( bundle[ "origin" ] . take ( ) ) ? ;
3154
3159
assert_eq ! ( origin. sender, chain_id1) ;
3155
3160
assert_eq ! ( origin. medium, Medium :: Direct ) ;
3156
3161
let sender_height =
3157
- serde_json:: from_value :: < BlockHeight > ( bundle[ "bundle" ] [ "height" ] . take ( ) ) . unwrap ( ) ;
3162
+ serde_json:: from_value :: < BlockHeight > ( bundle[ "bundle" ] [ "height" ] . take ( ) ) ? ;
3158
3163
assert_eq ! ( sender_height + BlockHeight ( 1 ) , next_height1) ;
3159
3164
}
3160
3165
0 commit comments