Skip to content

Commit f6ff0a2

Browse files
committed
fix: skip stake validation in no-bittensor mode for PeerIdentified event
- Parse created_at timestamp from Docker container info instead of using current time - Skip stake validation when validate_stake is disabled (--no-bittensor mode) - Show 'stake: N/A - local mode' in logs for local testing
1 parent d38b39b commit f6ff0a2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

bins/validator-node/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,7 @@ async fn main() -> Result<()> {
17911791
}
17921792
NetworkEvent::PeerIdentified { peer_id, hotkey, agent_version } => {
17931793
let peer_str = peer_id.to_string();
1794+
let should_validate_stake = protection.config().validate_stake;
17941795

17951796
if let Some(ref hk) = hotkey {
17961797
// Convert hex hotkey to SS58 for display
@@ -1805,6 +1806,13 @@ async fn main() -> Result<()> {
18051806
hk[..16.min(hk.len())].to_string()
18061807
};
18071808

1809+
// Skip stake validation if disabled (--no-bittensor mode)
1810+
if !should_validate_stake {
1811+
protection.check_hotkey_connection(hk, &peer_str, None);
1812+
info!("Peer identified: {} (hotkey: {}, stake: N/A - local mode)", peer_id, ss58);
1813+
continue;
1814+
}
1815+
18081816
// Validate stake immediately
18091817
let has_sufficient_stake = {
18101818
if let Ok(bytes) = hex::decode(hk) {

crates/secure-container-runtime/src/broker.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,12 @@ impl ContainerBroker {
661661
.and_then(|c| c.image.clone())
662662
.unwrap_or_default(),
663663
state,
664-
created_at: chrono::Utc::now(), // TODO: parse from info
664+
created_at: info
665+
.created
666+
.as_ref()
667+
.and_then(|s| chrono::DateTime::parse_from_rfc3339(s).ok())
668+
.map(|dt| dt.with_timezone(&chrono::Utc))
669+
.unwrap_or_else(chrono::Utc::now),
665670
ports: self.get_container_ports(container_id).await,
666671
endpoint: None,
667672
labels,

0 commit comments

Comments
 (0)