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

Closed
wants to merge 7 commits into from

Conversation

bochaco
Copy link
Contributor

@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
@bochaco bochaco force-pushed the feat-sybil-detection branch from 037b455 to 01684e6 Compare April 5, 2024 19:13
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 from 01684e6 to 7ae76ec Compare April 8, 2024 16:04
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
@bochaco bochaco force-pushed the feat-sybil-detection branch from 7ae76ec to 0522e65 Compare April 8, 2024 16:51
sn_networking/src/sybil.rs Fixed Show fixed Hide fixed
@bochaco bochaco force-pushed the feat-sybil-detection branch from cdd9b5e to f01b7cc Compare April 9, 2024 17:51
@@ -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
@bochaco bochaco force-pushed the feat-sybil-detection branch from a2578fe to 743d670 Compare April 10, 2024 15:33
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
@bochaco bochaco force-pushed the feat-sybil-detection branch from 86ca0e2 to cf6dbb6 Compare April 10, 2024 16:56
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 4 times, most recently from 72f85ed to 83f47bf Compare April 11, 2024 14:47
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
@bochaco bochaco force-pushed the feat-sybil-detection branch from 83f47bf to 992fcee Compare April 11, 2024 18:07
@bochaco bochaco force-pushed the feat-sybil-detection branch from 9a8e679 to e734056 Compare June 27, 2024 18:12
@bochaco
Copy link
Contributor Author

bochaco commented Jul 5, 2024

Closing it, keeping the branch though for potential references.

@bochaco bochaco closed this Jul 5, 2024
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.

1 participant