Ejemplo n.º 1
0
def add_compare_chains_parser(subparsers, parent_parser):
    """Creates the arg parsers needed for the compare command.
    """
    parser = subparsers.add_parser(
        'compare-chains',
        help='Compare chains from different nodes.',
        description=(
            'Compute and display information about how the chains at '
            'different nodes differ.'
        ),
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog='''
By default, prints a table of summary data and a table of per-node data with
the following fields. Pass --tree for a fork graph.

COMMON ANCESTOR
    The most recent block that all chains have in common.

COMMON HEIGHT
    Let min_height := the minimum height of any chain across all nodes passed
    in. COMMON HEIGHT = min_height.

HEAD
    The block id of the most recent block on a given chain.

HEIGHT
    The block number of the most recent block on a given chain.

LAG
    Let max_height := the maximum height of any chain across all nodes passed
    in. LAG = max_height - HEIGHT for a given chain.

DIVERG
    Let common_ancestor_height := the height of the COMMON ANCESTOR.
    DIVERG = HEIGHT - common_ancestor_height

''',
        parents=[parent_parser, base_multinode_parser()])

    parser.add_argument(
        '-l',
        '--limit',
        default=25,
        type=int,
        help='the number of blocks to request at a time',
    )

    parser.add_argument(
        '--table',
        action='store_true',
        help='Print out a fork table for all nodes since the common ancestor.')

    parser.add_argument(
        '--tree',
        action='store_true',
        help='Print out a fork tree for all nodes since the common ancestor.')
Ejemplo n.º 2
0
def add_compare_chains_parser(subparsers, parent_parser):
    """Creates the arg parsers needed for the compare command.
    """
    parser = subparsers.add_parser(
        'compare-chains',
        help='Compare chains from different nodes.',
        description=('Compute and display information about how the chains at '
                     'different nodes differ.'),
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog='''
By default, prints a table of summary data and a table of per-node data with
the following fields. Pass --tree for a fork graph.

COMMON ANCESTOR
    The most recent block that all chains have in common.

COMMON HEIGHT
    Let min_height := the minimum height of any chain across all nodes passed
    in. COMMON HEIGHT = min_height.

HEAD
    The block id of the most recent block on a given chain.

HEIGHT
    The block number of the most recent block on a given chain.

LAG
    Let max_height := the maximum height of any chain across all nodes passed
    in. LAG = max_height - HEIGHT for a given chain.

DIVERG
    Let common_ancestor_height := the height of the COMMON ANCESTOR.
    DIVERG = HEIGHT - common_ancestor_height

''',
        parents=[parent_parser, base_multinode_parser()])

    parser.add_argument(
        '-l',
        '--limit',
        default=25,
        type=int,
        help='the number of blocks to request at a time',
    )

    parser.add_argument(
        '--table',
        action='store_true',
        help='Print out a fork table for all nodes since the common ancestor.')

    parser.add_argument(
        '--tree',
        action='store_true',
        help='Print out a fork tree for all nodes since the common ancestor.')
Ejemplo n.º 3
0
def _add_list_parser(parser, parent_parser):
    help_text = 'Lists peers for validators with given URLs'

    list_parser = parser.add_parser(
        'list',
        help=help_text,
        description='{}.'.format(help_text),
        parents=[parent_parser, base_multinode_parser()])

    list_parser.add_argument(
        '--pretty', '-p',
        action='store_true',
        help='Pretty-print the results')
Ejemplo n.º 4
0
def _add_list_parser(parser, parent_parser):
    help_text = 'Lists peers for validators with given URLs'

    list_parser = parser.add_parser(
        'list',
        help=help_text,
        description='{}.'.format(help_text),
        parents=[parent_parser, base_multinode_parser()])

    list_parser.add_argument('--pretty',
                             '-p',
                             action='store_true',
                             help='Pretty-print the results')
Ejemplo n.º 5
0
def add_list_blocks_parser(subparsers, parent_parser):
    """Creates the arg parsers needed for the compare command.
    """
    parser = subparsers.add_parser(
        'list-blocks',
        help='List blocks from different nodes.',
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog='',
        parents=[parent_parser, base_multinode_parser()])

    parser.add_argument('-n',
                        '--count',
                        default=10,
                        type=int,
                        help='the number of blocks to list')
Ejemplo n.º 6
0
def _add_graph_parser(parser, parent_parser):
    help_text = "Generates a file to graph a network's peering arrangement"

    graph_parser = parser.add_parser(
        'graph',
        help=help_text,
        description='{}.'.format(help_text),
        parents=[parent_parser, base_multinode_parser()])

    graph_parser.add_argument(
        '-o',
        '--output',
        help='The path of the dot file to be produced (defaults to peers.dot)')

    graph_parser.add_argument('--force', action='store_true', help='TODO')
Ejemplo n.º 7
0
def add_list_blocks_parser(subparsers, parent_parser):
    """Creates the arg parsers needed for the compare command.
    """
    parser = subparsers.add_parser(
        'list-blocks',
        help='List blocks from different nodes.',
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog='',
        parents=[parent_parser, base_multinode_parser()])

    parser.add_argument(
        '-n',
        '--count',
        default=10,
        type=int,
        help='the number of blocks to list')
Ejemplo n.º 8
0
def _add_graph_parser(parser, parent_parser):
    help_text = "Generates a file to graph a network's peering arrangement"

    graph_parser = parser.add_parser(
        'graph',
        help=help_text,
        description='{}.'.format(help_text),
        parents=[parent_parser, base_multinode_parser()])

    graph_parser.add_argument(
        '-o', '--output',
        help='The path of the dot file to be produced (defaults to peers.dot)')

    graph_parser.add_argument(
        '--force',
        action='store_true',
        help='TODO')