Skip to content

[Feat] Make the connection stats ephemeral - #4384

Merged
vicsn merged 2 commits into
stagingfrom
feat/ephemeral_connection_stats
Aug 10, 2026
Merged

[Feat] Make the connection stats ephemeral#4384
vicsn merged 2 commits into
stagingfrom
feat/ephemeral_connection_stats

Conversation

@ljedrz

@ljedrz ljedrz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

This PR removes the persistent KnownPeers in favor of the Stats (the same as those of Tcp), which live for as long as the associated object (in this case the connection).

There are several benefits to this approach:

  • stats for multiple connections per IP can now be distinguished
  • the values can be used more reliably for peer heuristics (CC [Proposal] Introduce additional node hardening measures #4140)
  • no more lock contention for traffic accounting
  • peers changing their hardware or internet connection won't be affected by past failures

If we're interested in tracking long-term peer reputation, this should be done at the Peer (i.e. higher) level, and based on their Address.

Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
@ljedrz
ljedrz requested review from cbeck88 and vicsn August 10, 2026 11:41
Comment thread node/network/src/peering.rs
@veria-ai

veria-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

…cting}

Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>

@cbeck88 cbeck88 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this looks good to me, thaank you

@vicsn

vicsn commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Can you tackle CI in a separate PR? Maybe we need a bigger machine?

error: could not compile `snarkvm-ledger-puzzle-epoch` (lib)

Caused by:
  process didn't exit successfully: `/home/circleci/.rustup/toolchains/1.88-x86_64-unknown-linux-gnu/bin/rustc --crate-name snarkvm_ledger_puzzle_epoch --edition=2024 /home/circleci/.cargo/git/checkouts/snarkvm-cca64a3992502984/79949e1/ledger/puzzle/epoch/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C lto=off -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on --cfg 'feature="aleo-std"' --cfg 'feature="default"' --cfg 'feature="lru"' --cfg 'feature="parking_lot"' --cfg 'feature="rayon"' --cfg 'feature="snarkvm-circuit"' --cfg 'feature="snarkvm-synthesizer-process"' --cfg 'feature="snarkvm-synthesizer-program"' --cfg 'feature="synthesis"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("aleo-std", "default", "dev-print", "locktick", "lru", "merkle", "parking_lot", "rayon", "serial", "snarkvm-circuit", "snarkvm-synthesizer-process", "snarkvm-synthesizer-program", "synthesis", "timer", "wasm"))' -C metadata=35b3278aa17e74ab -C extra-filename=-80db91d8254757aa --out-dir /home/circleci/project/target/debug/deps -L dependency=/home/circleci/project/target/debug/deps --extern aleo_std=/home/circleci/project/target/debug/deps/libaleo_std-41342ee45f0660b9.rmeta --extern anyhow=/home/circleci/project/target/debug/deps/libanyhow-c844f5079120e8e5.rmeta --extern colored=/home/circleci/project/target/debug/deps/libcolored-129e2a66d025471e.rmeta --extern indexmap=/home/circleci/project/target/debug/deps/libindexmap-2d59ca0672d5a81d.rmeta --extern lru=/home/circleci/project/target/debug/deps/liblru-eab74573c44b560f.rmeta --extern parking_lot=/home/circleci/project/target/debug/deps/libparking_lot-acb41200195e9ca5.rmeta --extern rand=/home/circleci/project/target/debug/deps/librand-fb5ba73f500e5bd4.rmeta --extern rand_chacha=/home/circleci/project/target/debug/deps/librand_chacha-b3f5fe9b4c6094c5.rmeta --extern rayon=/home/circleci/project/target/debug/deps/librayon-f19e320dcd3581ca.rmeta --extern snarkvm_circuit=/home/circleci/project/target/debug/deps/libsnarkvm_circuit-41fa427bdc51069a.rmeta --extern snarkvm_console=/home/circleci/project/target/debug/deps/libsnarkvm_console-a15d6f94ead752b4.rmeta --extern snarkvm_ledger_puzzle=/home/circleci/project/target/debug/deps/libsnarkvm_ledger_puzzle-a1cf18e4a0808408.rmeta --extern snarkvm_synthesizer_process=/home/circleci/project/target/debug/deps/libsnarkvm_synthesizer_process-c97387c2d2723198.rmeta --extern snarkvm_synthesizer_program=/home/circleci/project/target/debug/deps/libsnarkvm_synthesizer_program-af6802fc2d8c5484.rmeta --extern snarkvm_utilities=/home/circleci/project/target/debug/deps/libsnarkvm_utilities-80edb15e92266f50.rmeta --cap-lints allow -C link-arg=-fuse-ld=lld -C target-cpu=skylake -L native=/home/circleci/project/target/debug/build/aws-lc-sys-6ff73797cb8cc3aa/out -L native=/home/circleci/project/target/debug/build/ring-5f0e48dc64037e34/out` (signal: 9, SIGKILL: kill)

@vicsn
vicsn merged commit 2ca7642 into staging Aug 10, 2026
4 of 5 checks passed
@vicsn
vicsn deleted the feat/ephemeral_connection_stats branch August 10, 2026 16:03
@ljedrz

ljedrz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

I'm already on it: #4386.

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.

3 participants