Compare commits

...

4 Commits

Author SHA1 Message Date
peilun-conflux
b39e761fc6
Merge 3957f8b28d into a4dd88f2b8 2024-09-11 18:00:16 +08:00
peilun-conflux
a4dd88f2b8
Change submit receipt to info. (#195)
Some checks failed
abi-consistent-check / build-and-compare (push) Has been cancelled
code-coverage / unittest-cov (push) Has been cancelled
rust / check (push) Has been cancelled
rust / test (push) Has been cancelled
rust / lints (push) Has been cancelled
functional-test / test (push) Has been cancelled
2024-09-11 17:59:43 +08:00
peilun-conflux
3dc3d0574f
Fix typos. (#193) 2024-09-11 17:57:41 +08:00
Peilun Li
3957f8b28d Add TopicScoreParams for gossipsubs. 2024-09-09 17:58:41 +08:00
3 changed files with 28 additions and 5 deletions

View File

@ -100,7 +100,7 @@ async fn request_miner_id(
.retries(3) .retries(3)
.await .await
.map_err(|e| format!("Fail to execute mine answer transaction: {:?}", e))? .map_err(|e| format!("Fail to execute mine answer transaction: {:?}", e))?
.ok_or("Request miner id transaction dropped after 3 retires")?; .ok_or("Request miner id transaction dropped after 3 retries")?;
let first_log = receipt let first_log = receipt
.logs .logs

View File

@ -167,12 +167,11 @@ impl Submitter {
.await .await
.map_err(|e| format!("Fail to execute mine answer transaction: {:?}", e))? .map_err(|e| format!("Fail to execute mine answer transaction: {:?}", e))?
.ok_or(format!( .ok_or(format!(
"Mine answer transaction dropped after {} retires", "Mine answer transaction dropped after {} retries",
SUBMISSION_RETIES SUBMISSION_RETIES
))?; ))?;
info!("Submit PoRA success"); info!("Submit PoRA success, receipt: {:?}", receipt);
debug!("Receipt: {:?}", receipt);
Ok(()) Ok(())
} }

View File

@ -13,6 +13,7 @@ use crate::types::{GossipEncoding, GossipKind, GossipTopic, SnappyTransform};
use crate::{error, metrics, Enr, NetworkGlobals, PubsubMessage, TopicHash}; use crate::{error, metrics, Enr, NetworkGlobals, PubsubMessage, TopicHash};
use futures::stream::StreamExt; use futures::stream::StreamExt;
use libp2p::gossipsub::error::PublishError; use libp2p::gossipsub::error::PublishError;
use libp2p::gossipsub::TopicScoreParams;
use libp2p::{ use libp2p::{
core::{ core::{
connection::ConnectionId, identity::Keypair, multiaddr::Protocol as MProtocol, Multiaddr, connection::ConnectionId, identity::Keypair, multiaddr::Protocol as MProtocol, Multiaddr,
@ -226,7 +227,30 @@ impl<AppReqId: ReqId> Behaviour<AppReqId> {
// trace!(behaviour_log, "Using peer score params"; "params" => ?params); // trace!(behaviour_log, "Using peer score params"; "params" => ?params);
let params = libp2p::gossipsub::PeerScoreParams::default(); let mut params = libp2p::gossipsub::PeerScoreParams::default();
let get_hash = |kind: GossipKind| -> TopicHash {
let topic: Topic = GossipTopic::new(kind, GossipEncoding::default()).into();
topic.hash()
};
params
.topics
.insert(get_hash(GossipKind::FindFile), TopicScoreParams::default());
params.topics.insert(
get_hash(GossipKind::FindChunks),
TopicScoreParams::default(),
);
params.topics.insert(
get_hash(GossipKind::AnnounceFile),
TopicScoreParams::default(),
);
params.topics.insert(
get_hash(GossipKind::AnnounceShardConfig),
TopicScoreParams::default(),
);
params.topics.insert(
get_hash(GossipKind::AnnounceChunks),
TopicScoreParams::default(),
);
// Set up a scoring update interval // Set up a scoring update interval
let update_gossipsub_scores = tokio::time::interval(params.decay_interval); let update_gossipsub_scores = tokio::time::interval(params.decay_interval);