You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The python equivalent for the above function is almost like this
fromtypingimportSet, Anydeffind_subnetworks_candidates_excluding_peer(
self,
peer_id: Any,
subnetworks: Set[Any]
) ->Set[Any]:
# Attempt to find common peers across all subnetworkspeers=set.intersection(
*(
self.filter_peers_for_subnetworks(peer_id, {subnetwork})
forsubnetworkinsubnetworks
)
) orset() # Default to empty set if no intersection is found# If no common peers, take the union of all subnetworks' peersifnotpeers:
peers=set.union(
*(
self.filter_peers_for_subnetworks(peer_id, {subnetwork})
forsubnetworkinsubnetworks
)
)
returnpeers
I might be wrong but I believe that you want to disperse the cancelled blobs into the target subnetworks in a optimal fashion but the second part (i.e. the union part) is concerning.
let's say you have three subnets like this with executors
X : a, b
Y : c, d
Z : e, f
Clearly you don't have any common validator in these cases so you take the union as a whole (a, b, c, d, e, f) but you could have also taken (a, c, e) and still would have achieved your goal of sending blobs to the respective networks.
The equivalent python code is like this
fromitertoolsimportcombinationsdefminimum_covering_set(tuples):
# Convert each tuple to a setsets= [set(t) fortintuples]
# Collect all unique elementsall_elements=set.union(*sets)
# Try all combinations from size 1 up to the total unique elementsforsizeinrange(1, len(all_elements) +1):
forcomboincombinations(all_elements, size):
# Check if the combination has at least one element in each setifall(any(einsforeincombo) forsinsets):
returncombo# Return the first minimum combo found# Example usagetuples= [('a', 'b', 'c'), ('d', 'e', 'f'), ('a', 'g')]
result=minimum_covering_set(tuples)
print(result)
Please check into this one.
The text was updated successfully, but these errors were encountered:
TakeASwing-420
changed the title
Dispersal Protocol's Executor Behaviour
Dispersal Protocol's Executor Behaviour Logic
Nov 12, 2024
@danielSanchezQ
nomos-node/nomos-da/network/core/src/protocols/dispersal/executor/behaviour.rs
Line 408 in f71db1a
The python equivalent for the above function is almost like this
I might be wrong but I believe that you want to disperse the cancelled blobs into the target subnetworks in a optimal fashion but the second part (i.e. the union part) is concerning.
let's say you have three subnets like this with executors
X : a, b
Y : c, d
Z : e, f
Clearly you don't have any common validator in these cases so you take the union as a whole (a, b, c, d, e, f) but you could have also taken (a, c, e) and still would have achieved your goal of sending blobs to the respective networks.
The equivalent python code is like this
Please check into this one.
The text was updated successfully, but these errors were encountered: