mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-03-14 05:15:18 +00:00
Compare commits
3 Commits
a6d9d80cf5
...
ce7393180b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ce7393180b | ||
![]() |
22ed8f5f91 | ||
![]() |
f456773b72 |
@ -26,10 +26,10 @@ use crate::peer_manager::PeerManager;
|
||||
use crate::Config;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref FIND_FILE_TIMEOUT: chrono::Duration = chrono::Duration::minutes(2);
|
||||
pub static ref ANNOUNCE_FILE_TIMEOUT: chrono::Duration = chrono::Duration::minutes(2);
|
||||
pub static ref ANNOUNCE_SHARD_CONFIG_TIMEOUT: chrono::Duration = chrono::Duration::minutes(2);
|
||||
pub static ref TOLERABLE_DRIFT: chrono::Duration = chrono::Duration::seconds(5);
|
||||
pub static ref FIND_FILE_TIMEOUT: chrono::Duration = chrono::Duration::minutes(5);
|
||||
pub static ref ANNOUNCE_FILE_TIMEOUT: chrono::Duration = chrono::Duration::minutes(5);
|
||||
pub static ref ANNOUNCE_SHARD_CONFIG_TIMEOUT: chrono::Duration = chrono::Duration::minutes(5);
|
||||
pub static ref TOLERABLE_DRIFT: chrono::Duration = chrono::Duration::seconds(10);
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
@ -403,7 +403,7 @@ impl Libp2pEventHandler {
|
||||
// verify timestamp
|
||||
let d = duration_since(timestamp);
|
||||
if d < TOLERABLE_DRIFT.neg() || d > *FIND_FILE_TIMEOUT {
|
||||
debug!(%timestamp, "Invalid timestamp, ignoring FindFile message");
|
||||
debug!(%timestamp, ?d, "Invalid timestamp, ignoring FindFile message");
|
||||
return MessageAcceptance::Ignore;
|
||||
}
|
||||
|
||||
@ -481,7 +481,7 @@ impl Libp2pEventHandler {
|
||||
// verify timestamp
|
||||
let d = duration_since(msg.timestamp);
|
||||
if d < TOLERABLE_DRIFT.neg() || d > *FIND_FILE_TIMEOUT {
|
||||
debug!(%msg.timestamp, "Invalid timestamp, ignoring FindFile message");
|
||||
debug!(%msg.timestamp, ?d, "Invalid timestamp, ignoring FindFile message");
|
||||
return MessageAcceptance::Ignore;
|
||||
}
|
||||
|
||||
@ -550,7 +550,8 @@ impl Libp2pEventHandler {
|
||||
let seen_ips: Vec<IpAddr> = match self.network_globals.peers.read().peer_info(peer_id) {
|
||||
Some(v) => v.seen_ip_addresses().collect(),
|
||||
None => {
|
||||
debug!(%announced_ip, "Failed to verify announced IP address, no peer info found");
|
||||
// ignore file announcement from un-seen peers
|
||||
trace!(%announced_ip, "Failed to verify announced IP address, no peer info found");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -558,7 +559,8 @@ impl Libp2pEventHandler {
|
||||
if seen_ips.iter().any(|x| *x == announced_ip) {
|
||||
true
|
||||
} else {
|
||||
debug!(%announced_ip, ?seen_ips, "Failed to verify announced IP address, mismatch with seen ips");
|
||||
// ignore file announcement if announced IP and seen IP mismatch
|
||||
trace!(%announced_ip, ?seen_ips, "Failed to verify announced IP address, mismatch with seen ips");
|
||||
false
|
||||
}
|
||||
}
|
||||
@ -587,7 +589,7 @@ impl Libp2pEventHandler {
|
||||
// propagate gossip to peers
|
||||
let d = duration_since(msg.resend_timestamp);
|
||||
if d < TOLERABLE_DRIFT.neg() || d > *ANNOUNCE_FILE_TIMEOUT {
|
||||
debug!(%msg.resend_timestamp, "Invalid resend timestamp, ignoring AnnounceFile message");
|
||||
debug!(%msg.resend_timestamp, ?d, "Invalid resend timestamp, ignoring AnnounceFile message");
|
||||
return MessageAcceptance::Ignore;
|
||||
}
|
||||
|
||||
@ -628,7 +630,7 @@ impl Libp2pEventHandler {
|
||||
// propagate gossip to peers
|
||||
let d = duration_since(msg.resend_timestamp);
|
||||
if d < TOLERABLE_DRIFT.neg() || d > *ANNOUNCE_SHARD_CONFIG_TIMEOUT {
|
||||
debug!(%msg.resend_timestamp, "Invalid resend timestamp, ignoring AnnounceShardConfig message");
|
||||
debug!(%msg.resend_timestamp, ?d, "Invalid resend timestamp, ignoring AnnounceShardConfig message");
|
||||
return MessageAcceptance::Ignore;
|
||||
}
|
||||
|
||||
@ -674,7 +676,7 @@ impl Libp2pEventHandler {
|
||||
// propagate gossip to peers
|
||||
let d = duration_since(msg.resend_timestamp);
|
||||
if d < TOLERABLE_DRIFT.neg() || d > *ANNOUNCE_FILE_TIMEOUT {
|
||||
debug!(%msg.resend_timestamp, "Invalid resend timestamp, ignoring AnnounceChunks message");
|
||||
debug!(%msg.resend_timestamp, ?d, "Invalid resend timestamp, ignoring AnnounceChunks message");
|
||||
return MessageAcceptance::Ignore;
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ impl SyncService {
|
||||
to_terminate.push(*tx_seq);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if self.controllers.contains_key(&min_tx_seq) {
|
||||
to_terminate.push(min_tx_seq);
|
||||
}
|
||||
|
||||
@ -757,9 +757,12 @@ impl SyncService {
|
||||
self.controllers.remove(tx_seq);
|
||||
}
|
||||
|
||||
debug!(?to_terminate, "File sync terminated");
|
||||
let num_terminated = to_terminate.len();
|
||||
if num_terminated > 0 {
|
||||
debug!(?to_terminate, "File sync terminated");
|
||||
}
|
||||
|
||||
to_terminate.len()
|
||||
num_terminated
|
||||
}
|
||||
|
||||
fn on_heartbeat(&mut self) {
|
||||
|
@ -1 +1 @@
|
||||
debug,hyper=info,h2=info,rpc=info,discv5=info,router=info,jsonrpsee_http_server=info
|
||||
debug,hyper=info,h2=info,rpc=info,discv5=info,jsonrpsee_http_server=info
|
@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
MINER_KEY=""
|
||||
MINE_CONTRACT=""
|
||||
BLOCKCHAIN_RPC=""
|
||||
FLOW_CONTRACT=""
|
||||
BLOCK_NUMBER=0
|
||||
PUBLIC_IP=$(curl -s https://ipinfo.io/ip)
|
||||
|
||||
FILE=run/config.toml
|
||||
|
||||
# enable sync
|
||||
sed -in-place='' 's/# \[sync\]/\[sync\]/g' $FILE
|
||||
# enable auto_sync
|
||||
sed -in-place='' 's/# auto_sync_enabled = false/auto_sync_enabled = true/g' $FILE
|
||||
# reduce timeout for finding peers
|
||||
sed -in-place='' 's/# find_peer_timeout = .*/find_peer_timeout = "10s"/g' $FILE
|
||||
# set public ip
|
||||
sed -in-place='' "s/# network_enr_address = .*/network_enr_address = \"$PUBLIC_IP\"/g" $FILE
|
||||
# set miner key
|
||||
sed -in-place='' "s/miner_key = \"\"/miner_key = \"$MINER_KEY\"/g" $FILE
|
||||
# set miner contract address
|
||||
sed -in-place='' "s/mine_contract_address = .*/mine_contract_address = \"$MINE_CONTRACT\"/g" $FILE
|
||||
# set blockchain rpc endpoint
|
||||
sed -in-place='' "s|blockchain_rpc_endpoint = .*|blockchain_rpc_endpoint = \"$BLOCKCHAIN_RPC\"|g" $FILE
|
||||
# set flow contract address
|
||||
sed -in-place='' "s/log_contract_address = .*/log_contract_address = \"$FLOW_CONTRACT\"/g" $FILE
|
||||
# set contract deployed block number
|
||||
sed -in-place='' "s/log_sync_start_block_number = .*/log_sync_start_block_number = $BLOCK_NUMBER/g" $FILE
|
||||
# update the boot node ids
|
||||
sed -in-place='' 's|network_boot_nodes = .*|network_boot_nodes = ["/ip4/54.219.26.22/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/52.52.127.117/udp/1234/p2p/16Uiu2HAkzRjxK2gorngB1Xq84qDrT4hSVznYDHj6BkbaE4SGx9oS","/ip4/18.167.69.68/udp/1234/p2p/16Uiu2HAm2k6ua2mGgvZ8rTMV8GhpW71aVzkQWy7D37TTDuLCpgmX"]|g' $FILE
|
Loading…
Reference in New Issue
Block a user