From a634aa07e03013a99b6894a8e4e9170d41c0e37f Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Thu, 29 Feb 2024 14:28:13 +0100 Subject: [PATCH] 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 --- DAS/node.py | 27 ++++++++++++++------------- smallConf.py | 8 +++++++- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/DAS/node.py b/DAS/node.py index cd8d433..505067d 100644 --- a/DAS/node.py +++ b/DAS/node.py @@ -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) diff --git a/smallConf.py b/smallConf.py index 9a204f0..841e6a9 100644 --- a/smallConf.py +++ b/smallConf.py @@ -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)