add config.validatorBasedCustody

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

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2024-02-29 14:28:13 +01:00
parent 3292d70c1a
commit a634aa07e0
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
2 changed files with 21 additions and 14 deletions

View File

@ -78,21 +78,22 @@ class Node:
self.rowIDs = set(rows)
self.columnIDs = set(columns)
if (self.vpn * self.shape.custodyRows) > self.shape.nbRows:
self.logger.warning("Row custody (*vpn) larger than number of rows!", extra=self.format)
self.rowIDs = range(self.shape.nbRows)
if config.validatorBasedCustody:
for v in validators:
self.rowIDs = self.rowIDs.union(v.rowIDs)
self.columnIDs = self.columnIDs.union(v.columnIDs)
else:
self.rowIDs = set(random.sample(range(self.shape.nbRows), self.vpn*self.shape.custodyRows))
if (self.vpn * self.shape.custodyRows) > self.shape.nbRows:
self.logger.warning("Row custody (*vpn) larger than number of rows!", extra=self.format)
self.rowIDs = range(self.shape.nbRows)
else:
self.rowIDs = set(random.sample(range(self.shape.nbRows), self.vpn*self.shape.custodyRows))
if (self.vpn * self.shape.custodyCols) > self.shape.nbCols:
self.logger.warning("Column custody (*vpn) larger than number of columns!", extra=self.format)
self.columnIDs = range(self.shape.nbCols)
else:
self.columnIDs = set(random.sample(range(self.shape.nbCols), self.vpn*self.shape.custodyCols))
#for v in validators:
# self.rowIDs = self.rowIDs.union(v.rowIDs)
# self.columnIDs = self.columnIDs.union(v.columnIDs)
if (self.vpn * self.shape.custodyCols) > self.shape.nbCols:
self.logger.warning("Column custody (*vpn) larger than number of columns!", extra=self.format)
self.columnIDs = range(self.shape.nbCols)
else:
self.columnIDs = set(random.sample(range(self.shape.nbCols), self.vpn*self.shape.custodyCols))
self.rowNeighbors = collections.defaultdict(dict)
self.columnNeighbors = collections.defaultdict(dict)

View File

@ -62,7 +62,13 @@ blockSizes = range(64, 113, 128)
# Per-topic mesh neighborhood size
netDegrees = range(8, 9, 2)
# number of rows and columns a validator is interested in
# 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
custody = [2]
# ratio of class1 nodes (see below for parameters per class)