Skip to content

Commit 9a55acd

Browse files
authored
feat(consensus): use distant regions in the node arrangement first (#9427)
# Description of change For easy debugging and making experiments, we shuffle the node arrangement to use more distant nodes at first positions, ## Links to any relevant issues Fixes #9426 ## How the change has been tested - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [ ] Patch-specific tests (correctness, functionality coverage) - [ ] I have added tests that prove my fix is effective or that my feature works - [x] I have checked that new and existing unit tests pass locally with my changes
1 parent 16822e3 commit 9a55acd

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

crates/iota-aws-orchestrator/src/net_latency/latency_matrix_builder.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ use super::{PerturbationSpec, TopologyLayout};
66
// Mainnet validator region indices (0-9 correspond to RTT_LATENCY_TABLE
77
// rows/cols). Extracted from current IOTA Mainnet validator list
88
// and checking IP geolocation.
9-
// Distribution: 18x US-East, 4x US-West, 2x Canada, 21x EU-West,
9+
// Distribution: 20x US-East, 4x US-West, 2x Canada, 21x EU-West,
1010
// 13x EU-North, 8x AP-Southeast, 1x AP-South, 1x AP-Northeast
1111
const MAINNET_NODE_REGIONS: [usize; 70] = [
12-
5, 3, 0, 3, 3, 3, 8, 3, 0, 5, 3, 5, 3, 3, 8, 5, 0, 1, 3, 1, 0, 5, 3, 5, 0, 5, 0, 0, 5, 5, 3, 5,
13-
3, 0, 3, 5, 3, 9, 3, 8, 0, 3, 3, 3, 2, 7, 0, 1, 0, 2, 0, 5, 0, 8, 8, 1, 0, 8, 0, 0, 3, 3, 8, 0,
14-
3, 0, 8, 5, 0, 0,
12+
5, 9, 0, 8, 8, 3, 8, 3, 0, 5, 3, 5, 3, 3, 8, 5, 0, 1, 3, 1, 0, 5, 3, 5, 0, 5, 0, 0, 5, 5, 3, 5,
13+
3, 0, 3, 5, 3, 3, 3, 8, 0, 3, 3, 3, 2, 7, 0, 1, 0, 2, 0, 5, 0, 8, 3, 1, 0, 8, 0, 0, 3, 3, 8, 0,
14+
3, 0, 3, 5, 0, 0,
1515
];
1616

1717
// RTT table for 10 AWS regions, in milliseconds.
@@ -309,4 +309,29 @@ mod tests {
309309
.build();
310310
println!("{:?}", matrix);
311311
}
312+
313+
#[test]
314+
fn test_mainnet_region_distribution() {
315+
let expected = [
316+
(0, 20),
317+
(1, 4),
318+
(2, 2),
319+
(3, 21),
320+
(5, 13),
321+
(7, 1),
322+
(8, 8),
323+
(9, 1),
324+
];
325+
let mut counts = [0usize; 10];
326+
for &region in &MAINNET_NODE_REGIONS {
327+
counts[region] += 1;
328+
}
329+
for &(region, expected_count) in &expected {
330+
assert_eq!(
331+
counts[region], expected_count,
332+
"Region {}: expected {}, got {}",
333+
region, expected_count, counts[region]
334+
);
335+
}
336+
}
312337
}

0 commit comments

Comments
 (0)