Skip to content

Commit

Permalink
fix: unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-zil committed Nov 26, 2024
1 parent 0fee1b4 commit 40168a9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion zilliqa/tests/it/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async fn block_production(mut network: Network) {
.map_or(0, |b| b.number())
>= 5
},
50,
100,
)
.await
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion zilliqa/tests/it/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ async fn test_eth_syncing(mut network: Network) {
network
.run_until_async(
|| async { wallet.get_block_number().await.unwrap().as_u64() > 4 },
50,
100,
)
.await
.unwrap();
Expand Down
24 changes: 19 additions & 5 deletions zilliqa/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,18 +1004,32 @@ impl Network {
let mut inner = node.inner.lock().unwrap();
// Send to nodes only in the same shard (having same chain_id)
if inner.config.eth_chain_id == sender_chain_id {
inner
.handle_broadcast(source, external_message.clone())
.unwrap();
match external_message {
// Re-route Proposals from Broadcast to Requests, which is the behaviour in Production.
ExternalMessage::Proposal(p) => inner
.handle_request(
source,
&p.hash().to_string(),
external_message.clone(),
ResponseChannel::Local,
)
.unwrap(),
_ => inner
.handle_broadcast(source, external_message.clone())
.unwrap(),
}
}
});
}
}
}
}
AnyMessage::Response { channel, message } => {
AnyMessage::Response { channel, message } => 'responses: {
info!(%message, ?channel, "response");
let destination = self.pending_responses.remove(channel).unwrap();
// skip on faux response
let Some(destination) = self.pending_responses.remove(channel) else {
break 'responses;
};
let (index, node) = self
.nodes
.iter()
Expand Down

0 comments on commit 40168a9

Please sign in to comment.