Ejemplo n.º 1
0
    def get_validator_chains(self):
        """Returns a list of edges main from validators current forkchoice to genesis"""
        vals_chain_edges = []
        for validator in self.validator_set:
            chain = utils.build_chain(validator.my_latest_message(), None)[:-1]
            vals_chain_edges.append(utils.edge(chain, 2, 'blue', 'solid'))

        return vals_chain_edges
Ejemplo n.º 2
0
    def get_validator_chains(self):
        """Returns a list of edges main from validators current forkchoice to genesis"""
        vals_chain_edges = []
        for validator in self.validator_set:
            chain = utils.build_chain(validator.my_latest_message(), None)[:-1]
            vals_chain_edges.append(utils.edge(chain, 2, 'blue', 'solid'))

        return vals_chain_edges
Ejemplo n.º 3
0
    def safe_messages(self):
        if not self.global_view.last_finalized_block:
            return set()

        return set(
            map(lambda link: link[0],
                utils.build_chain(self.global_view.last_finalized_block,
                                  None)))
Ejemplo n.º 4
0
    def safe_messages(self):
        if not self.global_view.last_finalized_block:
            return set()

        return set(
            map(
                lambda link: link[0],
                utils.build_chain(self.global_view.last_finalized_block, None)
            )
        )
Ejemplo n.º 5
0
    def report(self, num, name):
        """Display the view graph of the current global_view"""
        assert num == name and num == '', "...no validator or number needed to report!"

        if not self.display:
            return

        # Update the safe blocks!
        tip = self.network.global_view.estimate()
        while tip and self.block_fault_tolerance.get(
                tip, 0) != len(self.validator_set) - 1:
            oracle = CliqueOracle(tip, self.network.global_view,
                                  self.validator_set)
            fault_tolerance, num_node_ft = oracle.check_estimate_safety()

            if fault_tolerance > 0:
                self.block_fault_tolerance[tip] = num_node_ft

            tip = tip.estimate

        edgelist = []

        best_chain = utils.build_chain(self.network.global_view.estimate(),
                                       None)
        edgelist.append(utils.edge(best_chain, 5, 'red', 'solid'))

        for validator in self.validator_set:
            chain = utils.build_chain(validator.my_latest_message(), None)
            edgelist.append(utils.edge(chain, 2, 'blue', 'solid'))

        edgelist.append(utils.edge(self.blockchain, 2, 'grey', 'solid'))
        edgelist.append(utils.edge(self.communications, 1, 'black', 'dotted'))

        message_labels = {}
        for block in self.network.global_view.messages:
            message_labels[block] = block.sequence_number

        self.plot_tool.next_viewgraph(
            self.network.global_view,
            self.validator_set,
            edges=edgelist,
            message_colors=self.block_fault_tolerance,
            message_labels=message_labels)
Ejemplo n.º 6
0
 def get_best_chain(self):
     """Returns an edge made of the global forkchoice to genesis"""
     best_message = self.view.estimate()
     best_chain = utils.build_chain(best_message, None)[:-1]
     return utils.edge(best_chain, 5, 'red', 'solid')
Ejemplo n.º 7
0
 def get_best_chain(self):
     """Returns an edge made of the global forkchoice to genesis"""
     best_message = self.view.estimate()
     best_chain = utils.build_chain(best_message, None)[:-1]
     return utils.edge(best_chain, 5, 'red', 'solid')