Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Dashboard, documenting all endpoints and specific data fields used by the
frontend ([#1566](https://github.com/o1-labs/mina-rust/issues/1566))

- **Feature**: Add logging if initial peers are invalid
([#1703](https://github.com/o1-labs/mina-rust/pull/1703))

### Fixed

- **Docker Compose**: Fix frontend black screen issue by changing environment
Expand Down
3 changes: 2 additions & 1 deletion node/src/action_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ pub enum ActionKind {
EventSourceProcessEvents,
EventSourceWaitForEvents,
EventSourceWaitTimeout,
Exit,
ExternalSnarkWorkerCancelWork,
ExternalSnarkWorkerError,
ExternalSnarkWorkerKill,
Expand Down Expand Up @@ -757,7 +758,7 @@ pub enum ActionKind {
}

impl ActionKind {
pub const COUNT: u16 = 628;
pub const COUNT: u16 = 629;
}

impl std::fmt::Display for ActionKind {
Expand Down
27 changes: 26 additions & 1 deletion node/src/reducer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,32 @@ pub fn reducer(
let meta = action.meta().clone();
match action.action() {
Action::CheckTimeouts(_) => {
if state.p2p.ready().is_some() {
if let Some(p2p) = state.p2p.ready() {
if let Some(kad_state) = &p2p.network.scheduler.discovery_state {
if p2p.ready_peers().is_empty() && kad_state.has_bootstraped {
if let Some(tip) = &state.transition_frontier.best_tip_breadcrumb() {
// TODO: this might need to change in future
if tip.height() == 296372 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this value come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure where it comes from exactly, but when adding:

dbg!(state
                .transition_frontier
                .best_tip_breadcrumb()
                .map(|t| t.height()));

To check timeouts action and running node without internet connecting that is the value that gets printed

let initial_peers = state
.p2p
.config()
.initial_peers
.iter()
.map(|opts| opts.to_string())
.collect::<Vec<_>>()
.join(", ");

crate::core::error!(
crate::core::log::system_time();
summary = "Exiting",
error = "Invalid initial peers",
initial_peers = initial_peers
);
}
}
}
}

if let Err(error) =
P2pState::p2p_timeout_dispatch(Substate::new(state, dispatcher), &meta)
{
Expand Down
1 change: 1 addition & 0 deletions p2p/src/network/kad/p2p_network_kad_reducer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ impl super::P2pNetworkKadState {
time: meta.time(),
stats: bootstrap_state.stats.clone(),
};
state.has_bootstraped = true;
Ok(())
}
(_, P2pNetworkKademliaAction::UpdateRoutingTable { peer_id, addrs }) => {
Expand Down
2 changes: 2 additions & 0 deletions p2p/src/network/kad/p2p_network_kad_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub struct P2pNetworkKadState {
pub streams: StreamState<P2pNetworkKadStreamState>,
pub status: P2pNetworkKadStatus,
pub filter_addrs: bool,
pub has_bootstraped: bool,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still related to the initial goal of this patch? I don't understand the link.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, it is used in a condition above.

}

impl Default for P2pNetworkKadState {
Expand All @@ -74,6 +75,7 @@ impl Default for P2pNetworkKadState {
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(true),
has_bootstraped: false,
}
}
}
Expand Down
Loading