2023-02-24 18:08:41 +00:00
|
|
|
"""Example configuration file
|
|
|
|
|
|
|
|
This file illustrates how to define options and simulation parameter ranges.
|
|
|
|
It also defines the traversal order of the simulation space. As the file
|
|
|
|
extension suggests, configuration is pure python code, allowing complex
|
|
|
|
setups. Use at your own risk.
|
|
|
|
|
|
|
|
To use this example, run
|
|
|
|
python3 study.py config_example
|
|
|
|
|
|
|
|
Otherwise copy it and modify as needed. The default traversal order defined
|
|
|
|
in the nested loop of nextShape() is good for most cases, but customizable
|
|
|
|
if needed.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import logging
|
2023-03-06 21:46:17 +00:00
|
|
|
import itertools
|
2023-03-07 12:24:11 +00:00
|
|
|
import numpy as np
|
2023-02-24 18:08:41 +00:00
|
|
|
from DAS.shape import Shape
|
|
|
|
|
2023-04-27 11:58:51 +00:00
|
|
|
# Dump results into XML files
|
2023-02-24 18:08:41 +00:00
|
|
|
dumpXML = 1
|
2023-04-21 09:45:17 +00:00
|
|
|
|
2023-04-20 13:58:13 +00:00
|
|
|
# save progress and row/column distribution vectors to XML
|
2023-04-21 09:45:17 +00:00
|
|
|
saveProgress = 1
|
|
|
|
|
|
|
|
# plot progress for each run to PNG
|
|
|
|
plotProgress = 1
|
|
|
|
|
2023-04-27 11:58:51 +00:00
|
|
|
# Save row and column distributions
|
|
|
|
saveRCdist = 1
|
|
|
|
|
|
|
|
# Plot all figures
|
2023-02-24 18:08:41 +00:00
|
|
|
visualization = 1
|
2023-04-27 11:58:51 +00:00
|
|
|
|
|
|
|
# Verbosity level
|
2023-02-24 18:08:41 +00:00
|
|
|
logLevel = logging.INFO
|
|
|
|
|
2023-03-13 13:22:14 +00:00
|
|
|
# number of parallel workers. -1: all cores; 1: sequential
|
|
|
|
# for more details, see joblib.Parallel
|
2023-03-30 11:24:30 +00:00
|
|
|
numJobs = -1
|
2023-02-24 18:08:41 +00:00
|
|
|
|
|
|
|
# Number of simulation runs with the same parameters for statistical relevance
|
2023-03-30 11:24:30 +00:00
|
|
|
runs = range(3)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
|
|
|
# Number of validators
|
2023-04-21 09:45:17 +00:00
|
|
|
numberNodes = range(128, 513, 128)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2023-04-09 21:49:11 +00:00
|
|
|
# select failure model between: "random, sequential, MEP, MEP+1, DEP, DEP+1, MREP, MREP-1"
|
|
|
|
failureModels = ["random"]
|
|
|
|
|
2023-02-24 18:08:41 +00:00
|
|
|
# Percentage of block not released by producer
|
2023-04-21 09:45:17 +00:00
|
|
|
failureRates = range(40, 81, 20)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2024-01-20 19:57:17 +00:00
|
|
|
# Percentage of nodes that are considered malicious
|
2024-02-28 16:44:55 +00:00
|
|
|
maliciousNodes = range(40,41,20)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2024-01-22 20:16:18 +00:00
|
|
|
# Parameter to determine whether to randomly assign malicious nodes or not
|
|
|
|
# If True, the malicious nodes will be assigned randomly; if False, a predefined pattern may be used
|
|
|
|
randomizeMaliciousNodes = True
|
2023-02-24 18:08:41 +00:00
|
|
|
|
|
|
|
# Per-topic mesh neighborhood size
|
2023-04-21 09:45:17 +00:00
|
|
|
netDegrees = range(8, 9, 2)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2024-03-01 11:32:19 +00:00
|
|
|
# How many copies are sent out by the block producer
|
|
|
|
# Note, previously this was set to match netDegree
|
|
|
|
proposerPublishToR = "shape.netDegree"
|
|
|
|
proposerPublishToC = "shape.netDegree"
|
|
|
|
|
2024-02-29 13:28:13 +00:00
|
|
|
# the overall number of row/columns taken into custody by a node is determined by
|
|
|
|
# a base number (custody) and a class specific multiplier (validatorsPerNode).
|
|
|
|
# We support two models:
|
|
|
|
# - validatorsBasedCustody: each validator has a unique subset of size custody,
|
|
|
|
# and custody is the union of these. I.e. VPN is a "probabilistic multiplier"
|
|
|
|
# - !validatorsBasedCustody: VPN is interpreted as a simple custody multiplier
|
|
|
|
validatorBasedCustody = False
|
2024-03-04 10:54:25 +00:00
|
|
|
custodyRows = range(2, 3, 2)
|
|
|
|
custodyCols = range(2, 3, 2)
|
2023-03-13 14:00:43 +00:00
|
|
|
|
|
|
|
# ratio of class1 nodes (see below for parameters per class)
|
2023-04-21 09:45:17 +00:00
|
|
|
class1ratios = [0.8]
|
2023-03-07 12:24:11 +00:00
|
|
|
|
2023-03-13 14:00:43 +00:00
|
|
|
# Number of validators per beacon node
|
|
|
|
validatorsPerNode1 = [1]
|
2024-02-27 20:55:46 +00:00
|
|
|
validatorsPerNode2 = [5]
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2023-04-18 13:53:38 +00:00
|
|
|
# Set uplink bandwidth in megabits/second
|
|
|
|
bwUplinksProd = [200]
|
|
|
|
bwUplinks1 = [10]
|
|
|
|
bwUplinks2 = [200]
|
2023-03-03 17:41:12 +00:00
|
|
|
|
2023-03-30 11:41:50 +00:00
|
|
|
# Step duration in miliseconds (Classic RTT is about 100ms)
|
|
|
|
stepDuration = 50
|
|
|
|
|
2023-04-18 13:53:38 +00:00
|
|
|
# Segment size in bytes (with proof)
|
|
|
|
segmentSize = 560
|
|
|
|
|
2023-03-15 12:18:02 +00:00
|
|
|
# Set to True if you want your run to be deterministic, False if not
|
2023-03-30 11:24:30 +00:00
|
|
|
deterministic = True
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2023-03-15 12:18:02 +00:00
|
|
|
# If your run is deterministic you can decide the random seed. This is ignore otherwise.
|
|
|
|
randomSeed = "DAS"
|
|
|
|
|
2023-03-30 12:26:14 +00:00
|
|
|
# Number of steps without progress to stop simulation
|
|
|
|
steps4StopCondition = 7
|
2023-03-30 14:22:00 +00:00
|
|
|
|
2023-04-13 13:22:50 +00:00
|
|
|
# Number of validators ready to asume block is available
|
|
|
|
successCondition = 0.9
|
2023-04-21 09:45:17 +00:00
|
|
|
|
|
|
|
# If True, print diagnostics when the block is not available
|
|
|
|
diagnostics = False
|
|
|
|
|
2023-04-17 10:14:39 +00:00
|
|
|
# True to save git diff and git commit
|
2023-04-21 09:45:17 +00:00
|
|
|
saveGit = False
|
|
|
|
|
2024-03-04 08:52:15 +00:00
|
|
|
# configure Node options
|
|
|
|
repairOnTheFly = True
|
2024-03-04 16:50:17 +00:00
|
|
|
sendLineUntilR = "shape.nbColsK" # stop sending on a p2p link if at least this amount of samples passed
|
|
|
|
sendLineUntilC = lambda shape : shape.nbRowsK # stop sending on a p2p link if at least this amount of samples passed
|
2024-03-04 08:52:15 +00:00
|
|
|
perNeighborQueue = True # queue incoming messages to outgoing connections on arrival (as typical GossipSub impl)
|
|
|
|
shuffleQueues = True # shuffle the order of picking from active queues of a sender node
|
|
|
|
perNodeQueue = False # keep a global queue of incoming messages for later sequential dispatch
|
|
|
|
shuffleLines = True # shuffle the order of rows/columns in each iteration while trying to send
|
|
|
|
shuffleNeighbors = True # shuffle the order of neighbors when sending the same segment to each neighbor
|
|
|
|
dumbRandomScheduler = False # dumb random scheduler
|
|
|
|
segmentShuffleScheduler = True # send each segment that's worth sending once in shuffled order, then repeat
|
|
|
|
segmentShuffleSchedulerPersist = True # Persist scheduler state between timesteps
|
|
|
|
queueAllOnInit = False # queue up everything in the block producer, without shuffling, at the very beginning
|
|
|
|
forwardOnReceive = True # forward segments as soon as received
|
2024-03-12 22:16:52 +00:00
|
|
|
forwardWhenLineReceived = False # forward all segments when full line available (repaired segments are always forwarded)
|
2024-03-04 08:52:15 +00:00
|
|
|
|
2024-03-04 10:54:25 +00:00
|
|
|
cols = range(64, 113, 128)
|
|
|
|
rows = range(32, 113, 128)
|
|
|
|
colsK = range(32, 65, 128)
|
|
|
|
rowsK = range(32, 65, 128)
|
2024-02-15 18:18:30 +00:00
|
|
|
|
2023-02-24 18:08:41 +00:00
|
|
|
def nextShape():
|
2024-03-04 10:54:25 +00:00
|
|
|
for nbCols, nbColsK, nbRows, nbRowsK, run, fm, fr, mn, class1ratio, chR, chC, vpn1, vpn2, nn, netDegree, bwUplinkProd, bwUplink1, bwUplink2 in itertools.product(
|
|
|
|
cols, colsK, rows, rowsK, runs, failureModels, failureRates, maliciousNodes, class1ratios, custodyRows, custodyCols, validatorsPerNode1, validatorsPerNode2, numberNodes, netDegrees, bwUplinksProd, bwUplinks1, bwUplinks2):
|
2023-03-06 21:46:17 +00:00
|
|
|
# Network Degree has to be an even number
|
|
|
|
if netDegree % 2 == 0:
|
2024-03-04 10:54:25 +00:00
|
|
|
shape = Shape(nbCols, nbColsK, nbRows, nbRowsK, nn, fm, fr, mn, class1ratio, chR, chC, vpn1, vpn2, netDegree, bwUplinkProd, bwUplink1, bwUplink2, run)
|
2023-03-06 21:46:17 +00:00
|
|
|
yield shape
|
2024-03-04 09:09:27 +00:00
|
|
|
|
|
|
|
def evalConf(self, param, shape = None):
|
|
|
|
'''Allow lazy evaluation of params in various forms
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
sendLineUntilR = "shape.blockSizeRK"
|
|
|
|
sendLineUntilC = lambda shape : shape.blockSizeCK
|
|
|
|
perNodeQueue = "self.amIproposer"
|
|
|
|
'''
|
|
|
|
if callable(param):
|
|
|
|
return param(shape)
|
|
|
|
elif isinstance(param, str):
|
|
|
|
return eval(param)
|
|
|
|
else:
|
|
|
|
return param
|