Skip to content

Conversation

@intrigus-lgtm
Copy link
Contributor

When there are no peers and we try to add FD_GUI_MAX_PEER_CNT peers, gui->gossip.peer_cnt would previously be stuck at FD_GUI_MAX_PEER_CNT-1 due to the saturating arithmetic.
The effect is that ALL FD_GUI_MAX_PEER_CNT peers of the input msg would be copied into the peers array, but the last peer would be effectively ignored since the gui->gossip.peer_cnt would not reflect its addition.

The value of gui->gossip.peer_cnt is now allowed to go up to FD_GUI_MAX_PEER_CNT, so that all FD_GUI_MAX_PEER_CNT peers can be added when starting from zero peers.

The testing and bail-out when gui->gossip.peer_cnt is the maximum is unnecessary, due to the removal logic which ensures that the peer count can never exceed the maximum.

@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.053144 s 0.053956 s 1.528%
backtest mainnet-368528500-perf snapshot load 2.636 s 1.774 s -32.701%
backtest mainnet-368528500-perf total elapsed 53.143725 s 53.955633 s 1.528%
firedancer mem usage with mainnet.toml 996.11 GiB 996.11 GiB 0.000%

When there are no peers and we try to add `FD_GUI_MAX_PEER_CNT` peers,
`gui->gossip.peer_cnt` would previously be stuck at `FD_GUI_MAX_PEER_CNT-1` due to
the saturating arithmetic.
The effect is that ALL `FD_GUI_MAX_PEER_CNT` peers of the input `msg` would be _copied_
into the `peers` array, but the last peer would be effectively ignored since the
`gui->gossip.peer_cnt` would not reflect its addition.

The value of `gui->gossip.peer_cnt` is now allowed to go up to `FD_GUI_MAX_PEER_CNT`,
so that all `FD_GUI_MAX_PEER_CNT` peers can be added when starting from zero peers.


The testing and bail-out when `gui->gossip.peer_cnt` is the maximum is unnecessary, due
to the removal logic which ensures that the peer count can never exceed the maximum.
@intrigus-lgtm intrigus-lgtm force-pushed the intrigus/fix/gui-allow-max-peer-cnt branch from 8830672 to 5c3e4be Compare November 14, 2025 23:49
@github-actions
Copy link

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.073748 s 0.073865 s 0.159%
backtest mainnet-368528500-perf snapshot load 3.217 s 3.133 s -2.611%
backtest mainnet-368528500-perf total elapsed 73.748007 s 73.864797 s 0.158%
firedancer mem usage with mainnet.toml 997.12 GiB 997.12 GiB 0.000%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants