コード例 #1
0
def update_validator_config(args):
    health = DefaultApiHelper(verify_ssl=False).check_health()
    core_api_helper = CoreApiHelper(verify_ssl=False)

    key_list_response: KeyListResponse = core_api_helper.key_list()

    validator_info: EntityResponse = core_api_helper.entity(
        key_list_response.public_keys[0].identifiers.
        validator_entity_identifier)

    actions = []
    actions = ValidatorConfig.registration(actions, validator_info, health)
    actions = ValidatorConfig.validator_metadata(actions, validator_info,
                                                 health)
    actions = ValidatorConfig.add_validation_fee(actions, validator_info)
    actions = ValidatorConfig.setup_update_delegation(actions, validator_info)
    actions = ValidatorConfig.add_change_ownerid(actions, validator_info)
    build_response: ConstructionBuildResponse = core_api_helper.construction_build(
        actions, ask_user=True)
    if build_response:
        signed_transaction: KeySignResponse = core_api_helper.key_sign(
            build_response.unsigned_transaction)
        core_api_helper.construction_submit(
            signed_transaction.signed_transaction, print_response=True)

    if health['fork_vote_status'] == 'VOTE_REQUIRED':
        print("\n------Candidate fork detected------")
        engine_configuration = core_api_helper.engine_configuration()
        print_vote_and_fork_info(health, engine_configuration)
        should_vote = input(
            f"Do you want to signal the readiness for {core_api_helper.engine_configuration().forks[-1]['name']} now? [Y/n]{bcolors.ENDC}"
        )
        if Helpers.check_Yes(should_vote):
            core_api_helper.vote(print_response=True)
コード例 #2
0
def signal_candidate_fork_readiness(args):
    core_api_helper = CoreApiHelper(False)
    health = DefaultApiHelper(False).health()
    if health['fork_vote_status'] == 'VOTE_REQUIRED':
        candidate_fork_name = core_api_helper.engine_configuration(
        )["forks"][-1]['name']
        print(
            f"{bcolors.WARNING}NOTICE: Because the validator is running software with a candidate fork ({candidate_fork_name}{bcolors.WARNING}), "
            +
            "by performing this action, the validator will signal the readiness to run this fork onto the ledger.\n"
            +
            f"If you later choose to downgrade the software to a version that no longer includes this fork configuration, you should manually retract your readiness signal by using the retract-candidate-fork-readiness-signal subcommand.{bcolors.ENDC}"
        )
        should_vote = input(
            f"Do you want to signal the readiness for {core_api_helper.engine_configuration().forks[-1]['name']} now? [Y/n]{bcolors.ENDC}"
        )
        if Helpers.check_Yes(should_vote):
            core_api_helper.vote(print_response=True)
    else:
        print(
            f"{bcolors.WARNING}There's no need to signal the readiness for any candidate fork.{bcolors.ENDC}"
        )
コード例 #3
0
def health(args):
    defaultApiHelper = DefaultApiHelper(verify_ssl=False)
    defaultApiHelper.health(print_response=True)
コード例 #4
0
def version(args):
    defaultApiHelper = DefaultApiHelper(verify_ssl=False)
    defaultApiHelper.version()
コード例 #5
0
def metrics(args):
    defaultApiHelper = DefaultApiHelper(verify_ssl=False)
    defaultApiHelper.metrics()
コード例 #6
0
def fork_information(args):
    engine_configuration = CoreApiHelper(False).engine_configuration()
    health = DefaultApiHelper(False).health()
    print_vote_and_fork_info(health, engine_configuration)
コード例 #7
0
            dockercli_args.func(dockercli_args)

    elif args.subcommand == "systemd":
        systemdcli_args = systemdcli.parse_args(sys.argv[2:])
        if systemdcli_args.systemdcommand is None:
            systemdcli.print_help()
        else:
            systemdcli_args.func(systemdcli_args)

    elif args.subcommand == "api":
        apicli_args = apicli.parse_args(sys.argv[2:3])
        if apicli_args.apicommand is None:
            apicli.print_help()
        else:
            if apicli_args.apicommand == "metrics":
                defaultApi = DefaultApiHelper(verify_ssl=False)
                defaultApi.prometheus_metrics()
            elif apicli_args.apicommand == "system":
                handle_systemapi()
            elif apicli_args.apicommand == "core":
                handle_core()
            else:
                print(f"Invalid api command {apicli_args.apicommand}")

    elif args.subcommand == "monitoring":
        monitoringcli_args = monitoringcli.parse_args(sys.argv[2:])
        if monitoringcli_args.monitoringcommand is None:
            monitoringcli.print_help()
        else:
            monitoringcli_args.func(monitoringcli_args)
    elif args.subcommand == "auth":