Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(networking): adding API to perform sybil attack check #1573

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bochaco
Copy link
Member

@bochaco bochaco commented Apr 5, 2024

Description

reviewpad:summary

sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
@@ -431,6 +435,8 @@
}
}
SwarmCmd::PutLocalRecord { record } => {
// TODO: eclipse content if sybil was set, if sybil xorname set is close to the key ....?

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
@@ -379,6 +381,8 @@
sender,
quorum,
} => {
// TODO: eclipse content if sybil was set, if sybil xorname set is close to the key ....?

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
@@ -364,6 +364,8 @@
.payment_received();
}
SwarmCmd::GetLocalRecord { key, sender } => {
// TODO: eclipse content if sybil was set, if sybil xorname set is close to the key ....?

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
@bochaco bochaco force-pushed the feat-sybil-detection branch 2 times, most recently from 1d313c5 to 38e406b Compare April 9, 2024 17:58
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
@bochaco bochaco force-pushed the feat-sybil-detection branch 2 times, most recently from 48b20ff to 86ca0e2 Compare April 10, 2024 15:50
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
@bochaco bochaco force-pushed the feat-sybil-detection branch 2 times, most recently from 866df65 to 50cfb4a Compare April 10, 2024 20:07
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
let k = peers.len();
info!(">>> CHECKING SYBIL ATTACK WITH {k} PEERS: {peers:?}");

// FIXME: return error if we don't have at least K peer ids per key

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment

// Threshold to determine if there is an attack using Kullback-Liebler (KL) divergence
// between model peer ids distribution vs. actual distribution around any point in the address space.
const KL_DIVERGENCE_THRESHOLD: f64 = 10f64; // TODO: find a proper value

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
@bochaco bochaco force-pushed the feat-sybil-detection branch 3 times, most recently from d7ce052 to 72f85ed Compare April 10, 2024 20:42
fn get_net_size_estimate(random_keys: &RandomKeysAndClosestPeerIds) -> usize {
let mut best_n_found = 0;
let mut smallest_value_found = f64::MAX;
// FIXME: this iteration needs to be smarter

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
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.

None yet

1 participant