Example #1
0
 def test_UV_TR_001_004_to_008_011_to_017_VS_EP_001(self, new_genesis_env, clients_consensus):
     new_genesis_env.deploy_all()
     pip = clients_consensus[0].pip
     submitvpandvote(clients_consensus[:3])
     proposalinfo_version = pip.get_effect_proposal_info_of_vote()
     log.info('Get version proposal information {}'.format(proposalinfo_version))
     wait_block_number(pip.node, proposalinfo_version.get('ActiveBlock'))
     assert pip.get_status_of_proposal(proposalinfo_version.get('ProposalID')) == 5
     assert pip.chain_version == pip.cfg.version5
     assert pip.get_accuverifiers_count(proposalinfo_version.get('ProposalID')) == [4, 3, 0, 0]
     submittpandvote(clients_consensus[:2], 1, 2)
     submitcppandvote(clients_consensus[:2], [1, 2])
     proposalinfo_param = pip.get_effect_proposal_info_of_vote(pip.cfg.param_proposal)
     log.info('Get param proposal information {}'.format(proposalinfo_param))
     result = pip.vote(pip.node.node_id, proposalinfo_param.get('ProposalID'), pip.cfg.vote_option_yeas,
                       pip.node.staking_address, transaction_cfg=pip.cfg.transaction_cfg)
     log.info('Vote param proposal result : {}'.format(result))
     assert_code(result, 0)
     result = replace_version_declare(pip, pip.cfg.PLATON_NEW_BIN0, pip.cfg.version0)
     assert_code(result, 302028)
     result = replace_version_declare(pip, pip.cfg.PLATON_NEW_BIN, pip.cfg.version5)
     assert_code(result, 0)
     verifier_node_version(pip, pip.cfg.version5)
     result = replace_version_declare(pip, pip.cfg.PLATON_NEW_BIN4, pip.cfg.version4)
     assert_code(result, 0)
     verifier_node_version(pip, pip.cfg.version4)
     result = replace_version_declare(pip, pip.cfg.PLATON_NEW_BIN6, pip.cfg.version6)
     assert_code(result, 0)
     verifier_node_version(pip, pip.cfg.version6)
     result = pip.pip.listProposal()
     log.info('Interface listProposal result : {}'.format(result))
     assert_code(result, 0)
     result = pip.pip.getProposal(proposalinfo_version.get('ProposalID'))
     log.info('Interface getProposal result : {}'.format(result))
     assert_code(result, 0)
Example #2
0
 def test_1(self, new_genesis_env, clients_consensus):
     pip = clients_consensus[-1].pip
     submitvpandvote(clients_consensus[0:2])
     replace_version_declare(pip, pip.cfg.PLATON_NEW_BIN, pip.cfg.version5)
     proposalinfo = pip.get_effect_proposal_info_of_vote()
     wait_block_number(pip.node, proposalinfo.get('EndVotingBlock'))
     submitvpandvote(clients_consensus[:3])
     proposalinfo = pip.get_effect_proposal_info_of_vote()
     wait_block_number(pip.node, proposalinfo.get('EndVotingBlock'))
     verifier_list = get_pledge_list(clients_consensus[0].ppos.getVerifierList)
     log.info(verifier_list)
     assert pip.node.node_id in verifier_list
Example #3
0
    def test_UV_UPG_2(self, new_genesis_env, clients_consensus, client_noconsensus):
        new_genesis_env.deploy_all()
        pip = clients_consensus[0].pip
        pip_test = client_noconsensus.pip
        address, _ = pip_test.economic.account.generate_account(pip_test.node.web3, 10 ** 18 * 10000000)
        result = client_noconsensus.staking.create_staking(0, address, address, amount=10 ** 18 * 2000000,
                                                           transaction_cfg=pip_test.cfg.transaction_cfg)
        log.info('Node {} staking result : {}'.format(pip_test.node.node_id, result))
        programversion = client_noconsensus.staking.get_version()
        assert_code(programversion, pip.cfg.version0)
        pip_test.economic.wait_settlement_blocknum(pip_test.node)
        verifier_list = get_pledge_list(clients_consensus[0].ppos.getVerifierList)
        log.info('Get verifier list : {}'.format(verifier_list))
        assert pip_test.node.node_id in verifier_list

        submitvpandvote(clients_consensus)
        programversion = clients_consensus[0].staking.get_version()
        assert_code(programversion, pip.cfg.version0)
        proposalinfo = pip.get_effect_proposal_info_of_vote()
        log.info('Get version proposal information : {}'.format(proposalinfo))
        replace_version_declare(pip_test, pip_test.cfg.PLATON_NEW_BIN, pip_test.cfg.version5)
        assert_code(result, 0)
        programversion = client_noconsensus.staking.get_version()
        assert_code(programversion, pip.cfg.version0)
        wait_block_number(pip.node, proposalinfo.get('EndVotingBlock'))
        verifier_node_version(pip, proposalinfo.get('NewVersion'))
        assert_code(pip.get_status_of_proposal(proposalinfo.get('ProposalID')), 4)
        validator_list = get_pledge_list(clients_consensus[0].ppos.getValidatorList)
        log.info('Validator list : {}'.format(validator_list))
        wait_block_number(pip.node, proposalinfo.get('ActiveBlock'))

        validator_list = get_pledge_list(clients_consensus[0].ppos.getValidatorList)
        log.info('Validator list : {}'.format(validator_list))
        assert pip_test.node.node_id in validator_list

        assert_code(pip.get_status_of_proposal(proposalinfo.get('ProposalID')), 5)
        pip.economic.wait_settlement_blocknum(pip.node)
        validator_list = get_pledge_list(clients_consensus[0].ppos.getValidatorList)
        log.info('Validator list : {}'.format(validator_list))
        assert pip_test.node.node_id in validator_list
        verifier_list = get_pledge_list(clients_consensus[0].ppos.getVerifierList)
        log.info('Get verifier list : {}'.format(verifier_list))
        assert pip_test.node.node_id in verifier_list
        programversion = clients_consensus[0].staking.get_version()
        assert_code(programversion, pip.cfg.version5)
        programversion = client_noconsensus.staking.get_version()
        assert_code(programversion, pip_test.cfg.version5)