mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-04 22:23:07 +00:00
refactor
This commit is contained in:
parent
72156ccecc
commit
382aff1890
37
mixnet/v2/sim/2024-05-25T22:29:13.csv
Normal file
37
mixnet/v2/sim/2024-05-25T22:29:13.csv
Normal file
@ -0,0 +1,37 @@
|
||||
num_nodes,config,ingress_mean,ingress_max,egress_mean,egress_max
|
||||
10,1-to-all: 0: 0.0,0.390625,0.625,3.125,3.125
|
||||
10,1-to-all: 0: 0.02,0.3125,0.3125,3.125,3.125
|
||||
10,1-to-all: 2: 0.0,4.125,4.125,16.5,27.5
|
||||
10,1-to-all: 2: 0.02,2.75,4.125,13.75,13.75
|
||||
10,1-to-all: 4: 0.0,12.03125,12.03125,25.32894736842105,48.125
|
||||
10,1-to-all: 4: 0.02,12.03125,12.03125,25.32894736842105,48.125
|
||||
200,1-to-all: 0: 0.0,0.6,1.5625,62.5,62.5
|
||||
200,1-to-all: 0: 0.02,1.4732142857142858,2.8125,62.5,62.5
|
||||
200,1-to-all: 2: 0.0,10.3125,20.625,276.41752577319585,550.0
|
||||
200,1-to-all: 2: 0.02,10.525862068965518,20.625,278.7671232876712,550.0
|
||||
200,1-to-all: 4: 0.0,24.525240384615383,48.125,496.2305447470817,962.5
|
||||
200,1-to-all: 4: 0.02,26.717672413793103,72.1875,493.5111464968153,962.5
|
||||
400,1-to-all: 0: 0.0,1.3038793103448276,2.8125,125.0,125.0
|
||||
400,1-to-all: 0: 0.02,2.726293103448276,4.375,125.0,125.0
|
||||
400,1-to-all: 2: 0.0,16.78448275862069,41.25,562.7167630057803,1100.0
|
||||
400,1-to-all: 2: 0.02,23.232758620689655,49.5,562.6304801670146,1100.0
|
||||
400,1-to-all: 4: 0.0,49.369612068965516,132.34375,994.2491319444445,2887.5
|
||||
400,1-to-all: 4: 0.02,59.741379310344826,129.9375,1005.8055152394775,2887.5
|
||||
600,1-to-all: 0: 0.0,1.918103448275862,3.75,187.5,187.5
|
||||
600,1-to-all: 0: 0.02,3.9331896551724137,6.875,187.5,187.5
|
||||
600,1-to-all: 2: 0.0,25.03448275862069,49.5,831.2977099236641,1650.0
|
||||
600,1-to-all: 2: 0.02,33.23706896551724,68.75,839.3686502177068,1650.0
|
||||
600,1-to-all: 4: 0.0,71.77262931034483,192.5,1488.4907628128724,4331.25
|
||||
600,1-to-all: 4: 0.02,79.82112068965517,180.46875,1482.2705442902882,2887.5
|
||||
800,1-to-all: 0: 0.0,2.456896551724138,4.375,250.0,250.0
|
||||
800,1-to-all: 0: 0.02,5.226293103448276,7.5,250.0,250.0
|
||||
800,1-to-all: 2: 0.0,32.28879310344828,49.5,1114.732142857143,2200.0
|
||||
800,1-to-all: 2: 0.02,41.25,72.875,1127.208480565371,3300.0
|
||||
800,1-to-all: 4: 0.0,95.00538793103448,156.40625,1971.489266547406,3850.0
|
||||
800,1-to-all: 4: 0.02,122.13793103448276,192.5,1980.1537386443047,5775.0
|
||||
1000,1-to-all: 0: 0.0,2.877155172413793,5.9375,312.5,312.5
|
||||
1000,1-to-all: 0: 0.02,6.228448275862069,9.375,312.5,312.5
|
||||
1000,1-to-all: 2: 0.0,45.23275862068966,74.25,1388.095238095238,2750.0
|
||||
1000,1-to-all: 2: 0.02,52.866379310344826,74.25,1392.4841053587647,4125.0
|
||||
1000,1-to-all: 4: 0.0,120.72737068965517,192.5,2458.6332514044943,4812.5
|
||||
1000,1-to-all: 4: 0.02,136.57543103448276,223.78125,2461.58328154133,7218.75
|
||||
|
37
mixnet/v2/sim/2024-05-25T23:16:39.csv
Normal file
37
mixnet/v2/sim/2024-05-25T23:16:39.csv
Normal file
@ -0,0 +1,37 @@
|
||||
num_nodes,config,ingress_mean,ingress_max,egress_mean,egress_max
|
||||
10,gossip: 0: 0.0,1.65625,2.5,1.65625,1.875
|
||||
10,gossip: 0: 0.02,1.6875,2.5,1.6875,1.875
|
||||
10,gossip: 2: 0.0,21.93125,33.0,21.93125,23.375
|
||||
10,gossip: 2: 0.02,7.5625,12.375,7.5625,8.25
|
||||
10,gossip: 4: 0.0,72.66875,105.875,72.66875,84.21875
|
||||
10,gossip: 4: 0.02,46.248125,93.84375,46.248125,72.1875
|
||||
200,gossip: 0: 0.0,4.8561875,24.0625,4.8561875,11.25
|
||||
200,gossip: 0: 0.02,8.74229525862069,37.5,8.74229525862069,18.75
|
||||
200,gossip: 2: 0.0,60.64959202175884,288.75,60.815,123.75
|
||||
200,gossip: 2: 0.02,67.73155172413793,330.0,67.73155172413793,165.0
|
||||
200,gossip: 4: 0.0,169.6930894308943,620.8125,174.26546489563566,360.9375
|
||||
200,gossip: 4: 0.02,183.93375,690.59375,184.40130926724137,404.25
|
||||
400,gossip: 0: 0.0,6.451481681034482,32.8125,6.451481681034482,13.125
|
||||
400,gossip: 0: 0.02,15.15870150862069,64.0625,15.15870150862069,28.125
|
||||
400,gossip: 2: 0.0,103.01286637931034,474.375,103.08695043103448,222.75
|
||||
400,gossip: 2: 0.02,133.36148706896552,496.375,133.36207974137932,255.75
|
||||
400,gossip: 4: 0.0,238.6203448275862,1217.5625,239.8322528668736,664.125
|
||||
400,gossip: 4: 0.02,348.4793480603448,1241.625,349.7957327586207,678.5625
|
||||
600,gossip: 0: 0.0,10.845707614942528,48.125,10.845707614942528,20.625
|
||||
600,gossip: 0: 0.02,21.99876077586207,85.0,21.99876077586207,31.875
|
||||
600,gossip: 2: 0.0,134.6136063218391,833.25,134.6136063218391,297.0
|
||||
600,gossip: 2: 0.02,186.97431752873564,603.625,186.98158764367815,288.75
|
||||
600,gossip: 4: 0.0,468.0078807471264,1722.875,469.76112428160917,851.8125
|
||||
600,gossip: 4: 0.02,596.8570366379311,2057.34375,598.305626795977,1025.0625
|
||||
800,gossip: 0: 0.0,13.49982489224138,70.0,13.49982489224138,30.0
|
||||
800,gossip: 0: 0.02,31.12440732758621,96.25,31.12440732758621,41.25
|
||||
800,gossip: 2: 0.0,204.4971713362069,820.875,204.60337823275862,363.0
|
||||
800,gossip: 2: 0.02,263.0346551724138,1427.25,263.1884536637931,486.75
|
||||
800,gossip: 4: 0.0,510.1774811422414,1944.25,511.705864762931,895.125
|
||||
800,gossip: 4: 0.02,677.2293130387931,2057.34375,678.0591581357759,981.75
|
||||
1000,gossip: 0: 0.0,17.376422413793104,89.0625,17.376422413793104,35.625
|
||||
1000,gossip: 0: 0.02,35.141433189655174,138.125,35.141433189655174,63.75
|
||||
1000,gossip: 2: 0.0,248.81137068965518,979.0,249.05687931034484,404.25
|
||||
1000,gossip: 2: 0.02,327.9825431034483,1344.75,328.2077586206897,552.75
|
||||
1000,gossip: 4: 0.0,710.1483480603448,2632.4375,711.7312456896552,1212.75
|
||||
1000,gossip: 4: 0.02,836.671213362069,2622.8125,839.1504806034483,1284.9375
|
||||
|
6
mixnet/v2/sim/2024-05-27T14:14:58.csv
Normal file
6
mixnet/v2/sim/2024-05-27T14:14:58.csv
Normal file
@ -0,0 +1,6 @@
|
||||
num_nodes,num_mix_layers,p2p_type,real_message_prob,cover_message_prob,egress_mean,egress_max,ingress_mean,ingress_max
|
||||
1000,4,gossip,0.03,0.06,2541.7524924568966,3335.0625,2537.05615625,7637.4375
|
||||
1000,4,gossip,0.03,0.12,3481.2558782327587,4287.9375,3475.6617618534483,9107.65625
|
||||
1000,4,gossip,0.03,0.18,4284.96495150862,4908.75,4280.065577586207,11877.25
|
||||
1000,4,gossip,0.03,0.24,5208.071651939656,5962.6875,5202.543334051724,12478.8125
|
||||
1000,4,gossip,0.03,0.30,6017.549585129311,7132.125,6013.211033405172,15058.3125
|
||||
|
6
mixnet/v2/sim/2024-05-27T15:04:51.csv
Normal file
6
mixnet/v2/sim/2024-05-27T15:04:51.csv
Normal file
@ -0,0 +1,6 @@
|
||||
num_nodes,num_mix_layers,p2p_type,real_message_prob,cover_message_prob,egress_mean,egress_max,ingress_mean,ingress_max
|
||||
10,4,gossip,0.01,0.02,36.4375,79.40625,36.4375,98.65625
|
||||
10,4,gossip,0.01,0.04,14.718229166666667,28.875,14.718229166666667,33.6875
|
||||
10,4,gossip,0.01,0.06,27.848333333333333,98.65625,27.848333333333333,113.09375
|
||||
10,4,gossip,0.01,0.08,19.75955882352941,79.40625,19.75955882352941,91.4375
|
||||
10,4,gossip,0.01,0.1,27.62121710526316,98.65625,27.62121710526316,134.75
|
||||
|
6
mixnet/v2/sim/2024-05-27T15:55:35.csv
Normal file
6
mixnet/v2/sim/2024-05-27T15:55:35.csv
Normal file
@ -0,0 +1,6 @@
|
||||
num_nodes,num_mix_layers,p2p_type,real_message_prob,cover_message_prob,egress_mean,egress_max,ingress_mean,ingress_max
|
||||
1000,4,gossip,0.01,0.02,789.9003512931034,1270.5,786.5745818965518,2697.40625
|
||||
1000,4,gossip,0.01,0.04,1040.332811422414,1660.3125,1038.5553394396552,4716.25
|
||||
1000,4,gossip,0.01,0.06,1408.3879989224138,1992.375,1406.3984450431035,5681.15625
|
||||
1000,4,gossip,0.01,0.08,1721.6532887931035,2252.25,1720.1033318965517,6102.25
|
||||
1000,4,gossip,0.01,0.1,1984.492207974138,2483.25,1981.9849784482758,5625.8125
|
||||
|
@ -174,28 +174,36 @@ class Analysis:
|
||||
- there is no message to track back within a reasonable time window
|
||||
- enough hops have been traversed
|
||||
"""
|
||||
MAX_HOPS = 4 * 9
|
||||
nodes_per_hop = [] # [Counter[Node]]
|
||||
for receivers in reversed(self.sim.p2p.adversary.msgs_in_node_per_window):
|
||||
if len(nodes_per_hop) == 0:
|
||||
receivers = {node: (msg_cnt, senders) for node, (msg_cnt, senders) in receivers.items() if len(senders) > 0}
|
||||
if len(receivers) == 0:
|
||||
continue
|
||||
_, (_, senders) = random.choice(list(receivers.items()))
|
||||
nodes_per_hop.append(Counter(senders))
|
||||
for t in range(len(self.sim.p2p.adversary.msgs_in_node_per_window)-1, 0, -1):
|
||||
items = self.sim.p2p.adversary.msgs_in_node_per_window[t].items()
|
||||
actual_receivers = [node for node, (msg_cnt, senders) in items if len(senders) > 0]
|
||||
if len(actual_receivers) == 0:
|
||||
continue
|
||||
elif len(nodes_per_hop) >= MAX_HOPS:
|
||||
receiver = random.choice(actual_receivers)
|
||||
nodes_per_hop = self.timing_attack_with(receiver, t)
|
||||
self.print_nodes_per_hop(nodes_per_hop)
|
||||
break
|
||||
|
||||
def timing_attack_with(self, starting_node: "Node", starting_time: int):
|
||||
_, senders = self.sim.p2p.adversary.msgs_in_node_per_window[starting_time][starting_node]
|
||||
nodes_per_hop = [Counter(senders)]
|
||||
|
||||
MAX_HOPS = 4 * 8
|
||||
for t in range(starting_time-1, 0, -1):
|
||||
if len(nodes_per_hop) >= MAX_HOPS:
|
||||
break
|
||||
|
||||
next_nodes = Counter()
|
||||
for node in nodes_per_hop[-1]:
|
||||
if node not in receivers:
|
||||
continue
|
||||
_, senders = receivers[node]
|
||||
_, senders = self.sim.p2p.adversary.msgs_in_node_per_window[t][node]
|
||||
next_nodes.update(senders)
|
||||
if len(next_nodes) == 0:
|
||||
break
|
||||
nodes_per_hop.append(next_nodes)
|
||||
|
||||
return nodes_per_hop
|
||||
|
||||
@staticmethod
|
||||
def print_nodes_per_hop(nodes_per_hop):
|
||||
for i, nodes in enumerate(nodes_per_hop):
|
||||
print(f"{i}: len:{len(nodes)}: {sorted([node.id for node in nodes])}")
|
||||
print(f"hop-{i}: {len(nodes)} nodes: {sorted([node.id for node in nodes])}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user