def test_check_chain_id(self): # evm.set_chain_id(2) args = {'chainid': 2} r = eosapi.push_action(main_account, 'setchainid', args, {main_account:'active'}) print('++++console:', r['processed']['action_traces'][0]['console']) print(r['processed']['elapsed']) transaction = { 'from':shared.eth_address, 'to': w3.toChecksumAddress(shared.main_eth_address), 'value': 1000, 'gas': 2000000, 'gasPrice': 1, 'nonce': 0, 'chainId': 1 } try: w3.eth.sendTransaction(transaction) except Exception as e: e = json.loads(e.response) logger.info(e['error']['details'][0]['message']) assert e['error']['details'][0]['message'] == "assertion failure with message: bad chain id!" time.sleep(0.5) evm.set_chain_id(1) args = {'chainid': 1} r = eosapi.push_action(main_account, 'setchainid', args, {main_account:'active'}) print('++++console:', r['processed']['action_traces'][0]['console']) print(r['processed']['elapsed']) logger.info(shared.main_eth_address) transaction = { 'from':shared.eth_address, 'to': w3.toChecksumAddress(shared.main_eth_address), 'value': 1, 'gas': 2000000, 'gasPrice': 2, 'nonce': 0, 'chainId': 1 } w3.eth.sendTransaction(transaction)
def __init__(self, testName, extra_args=[]): super(EVMTestCase, self).__init__(testName) self.extra_args = extra_args evm.set_current_account(test_account) evm.set_chain_id(1)