Skip to content

Commit

Permalink
feat: use libp2p timeout instead of internal sync timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-zil committed Jan 28, 2025
1 parent a5ea91d commit 269df2e
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 130 deletions.
9 changes: 1 addition & 8 deletions zilliqa/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::{
ExternalMessage, InternalMessage, NewView, Proposal, QuorumCertificate, Vote,
MAX_COMMITTEE_SIZE,
},
node::{MessageSender, NetworkMessage, OutgoingMessageFailure},
node::{MessageSender, NetworkMessage},
pool::{TransactionPool, TxAddResult, TxPoolContent},
state::State,
sync::{Sync, SyncPeers},
Expand Down Expand Up @@ -3125,13 +3125,6 @@ impl Consensus {
Ok(count)
}

pub fn report_outgoing_message_failure(
&mut self,
_failure: OutgoingMessageFailure,
) -> Result<()> {
Ok(()) // FIXME: Stub
}

pub fn tick(&mut self) -> Result<()> {
trace!("consensus::tick()");
trace!("request_missing_blocks from timer");
Expand Down
2 changes: 1 addition & 1 deletion zilliqa/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl Node {
failure: OutgoingMessageFailure,
) -> Result<()> {
debug!(from = %self.peer_id, %to, ?failure, "handling message failure");
self.consensus.report_outgoing_message_failure(failure)?;
self.consensus.sync.handle_request_failure(failure)?;
Ok(())
}

Expand Down
3 changes: 2 additions & 1 deletion zilliqa/src/p2p_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ impl P2pNode {
Ok(Behaviour {
request_response: request_response::cbor::Behaviour::new(
iter::once((StreamProtocol::new("/zq2-message/1"), ProtocolSupport::Full)),
Default::default(),
request_response::Config::default()
.with_request_timeout(Duration::from_secs(10)),
),
gossipsub: gossipsub::Behaviour::new(
MessageAuthenticity::Signed(key_pair.clone()),
Expand Down
Loading

0 comments on commit 269df2e

Please sign in to comment.