Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createAccount crashes with a parse error if not specifying enough RAM #82

Open
elboletaire opened this issue Dec 8, 2022 · 1 comment

Comments

@elboletaire
Copy link

Hi guys, awesome work you're doing here. I've recently ported a really simple SC from C++ to TS thanks to your library and I have to say that I love being able to use typescript for building smart contracts (rather than C++, at which I'm a noob).

Now I'm trying to make things a bit more complicated, requiring me to create many 3rd party contracts for my tests, which drove me nuts for some time because the createAccount function was crashing since I wasn't specifying enough RAM, and took me an embarrassing amount of time to realize through the eosdebugger output.

imatge

Specifying enough ram makes it work, but I thought it was worth noticing that the parsing fails in case of error, which is a bit annoying.

@elboletaire
Copy link
Author

Sorry I forgot the output from eosdebugger, here's it:

2022-12-08 18:37:55,729 ERROR app 1741 Exception on /api/create_account [POST]
Traceback (most recent call last):
  File "/home/elboletaire/.local/lib/python3.10/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/elboletaire/.local/lib/python3.10/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/elboletaire/.local/lib/python3.10/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/elboletaire/.local/lib/python3.10/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/elboletaire/.local/lib/python3.10/site-packages/ipyeos/rpc_server.py", line 153, in call_method
    ret = getattr(proxy, method)(**kwargs)
  File "/home/elboletaire/.local/lib/python3.10/site-packages/ipyeos/rpc_server.py", line 88, in create_account
    return self.handler.create_account(id, creator, account, owner_key, active_key, ram_bytes, stake_net, stake_cpu)
  File "/home/elboletaire/.local/lib/python3.10/site-packages/ipyeos/server.py", line 978, in create_account
    ret = tester.create_account(creator, account, owner_key, active_key, ram_bytes, stake_net, stake_cpu)
  File "/home/elboletaire/.local/lib/python3.10/site-packages/ipyeos/chaintester.py", line 558, in create_account
    return self.push_actions_ex(actions)
  File "/home/elboletaire/.local/lib/python3.10/site-packages/ipyeos/chaintester.py", line 468, in push_actions_ex
    result = self.chain.push_transaction(raw_signed_trx, deadline, billed_cpu_time_us, explicit_cpu_bill)
  File "/home/elboletaire/.local/lib/python3.10/site-packages/ipyeos/chain.py", line 401, in push_transaction
    raise Exception(result)
Exception: {'id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'elapsed': 356, 'net_usage': 331, 'scheduled': False, 'action_traces': [{'action_ordinal': 1, 'creator_action_ordinal': 0, 'closest_unnotified_ancestor_action_ordinal': 0, 'receipt': {'receiver': 'eosio', 'act_digest': 'b69f434b2123fffbbd4d317b4c1303c543352660f17ff342efa1981e480689aa', 'global_sequence': 65, 'recv_sequence': 56, 'auth_sequence': [['hello', 1]], 'code_sequence': 2, 'abi_sequence': 2}, 'receiver': 'eosio', 'act': {'account': 'eosio', 'name': 'newaccount', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36aa0223297ba56a34a01000000010002a891e0dd57132ed683bc875dacc961c6fd5dfae6800bc6181ab68bb848251e520100000001000000010002a891e0dd57132ed683bc875dacc961c6fd5dfae6800bc6181ab68bb848251e5201000000'}, 'context_free': False, 'elapsed': 48, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [{'account': 'delphioracle', 'delta': 2996}], 'return_value': ''}, {'action_ordinal': 2, 'creator_action_ordinal': 0, 'closest_unnotified_ancestor_action_ordinal': 0, 'receipt': {'receiver': 'eosio', 'act_digest': 'a0cbcb4cb92981541df22e0d66dc5d9b2a101756706dd57cdfeabb50aec043a6', 'global_sequence': 66, 'recv_sequence': 57, 'auth_sequence': [['hello', 2]], 'code_sequence': 2, 'abi_sequence': 2}, 'receiver': 'eosio', 'act': {'account': 'eosio', 'name': 'buyrambytes', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36aa0223297ba56a34a00040000'}, 'context_free': False, 'elapsed': 74, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [], 'return_value': ''}, {'action_ordinal': 3, 'creator_action_ordinal': 0, 'closest_unnotified_ancestor_action_ordinal': 0, 'receipt': {'receiver': 'eosio', 'act_digest': '9cbf0eedd6c3c70f9afdebc1e77ff674a065b09693b84a1a5a4505008b6caeec', 'global_sequence': 73, 'recv_sequence': 58, 'auth_sequence': [['hello', 9]], 'code_sequence': 2, 'abi_sequence': 2}, 'receiver': 'eosio', 'act': {'account': 'eosio', 'name': 'delegatebw', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36aa0223297ba56a34a000400000000000004454f5300000000000400000000000004454f530000000001'}, 'context_free': False, 'elapsed': 44, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [{'account': 'delphioracle', 'delta': 562}], 'return_value': ''}, {'action_ordinal': 4, 'creator_action_ordinal': 2, 'closest_unnotified_ancestor_action_ordinal': 2, 'receipt': {'receiver': 'eosio.token', 'act_digest': 'eeb53735fe5624178a6d001dcf8fecf6375d8cbe902f89407949c92aabd5bea2', 'global_sequence': 67, 'recv_sequence': 7, 'auth_sequence': [['eosio.ram', 1], ['hello', 3]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'eosio.token', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}, {'actor': 'eosio.ram', 'permission': 'active'}], 'data': '00000000001aa36a000090e602ea3055940000000000000004454f5300000000076275792072616d'}, 'context_free': False, 'elapsed': 20, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [{'account': 'eosio', 'delta': -128}, {'account': 'eosio.ram', 'delta': 240}, {'account': 'hello', 'delta': 128}], 'return_value': ''}, {'action_ordinal': 5, 'creator_action_ordinal': 2, 'closest_unnotified_ancestor_action_ordinal': 2, 'receipt': {'receiver': 'eosio.token', 'act_digest': '8936fa535712d0095a1fcdcaec686c5ee65678aef36efa058a687675863e47ae', 'global_sequence': 70, 'recv_sequence': 8, 'auth_sequence': [['hello', 6]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'eosio.token', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36aa0d492e602ea3055010000000000000004454f53000000000772616d20666565'}, 'context_free': False, 'elapsed': 12, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [{'account': 'hello', 'delta': 240}], 'return_value': ''}, {'action_ordinal': 6, 'creator_action_ordinal': 4, 'closest_unnotified_ancestor_action_ordinal': 4, 'receipt': {'receiver': 'hello', 'act_digest': 'eeb53735fe5624178a6d001dcf8fecf6375d8cbe902f89407949c92aabd5bea2', 'global_sequence': 68, 'recv_sequence': 2, 'auth_sequence': [['eosio.ram', 2], ['hello', 4]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'hello', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}, {'actor': 'eosio.ram', 'permission': 'active'}], 'data': '00000000001aa36a000090e602ea3055940000000000000004454f5300000000076275792072616d'}, 'context_free': False, 'elapsed': 1, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [], 'return_value': ''}, {'action_ordinal': 7, 'creator_action_ordinal': 4, 'closest_unnotified_ancestor_action_ordinal': 4, 'receipt': {'receiver': 'eosio.ram', 'act_digest': 'eeb53735fe5624178a6d001dcf8fecf6375d8cbe902f89407949c92aabd5bea2', 'global_sequence': 69, 'recv_sequence': 1, 'auth_sequence': [['eosio.ram', 3], ['hello', 5]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'eosio.ram', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}, {'actor': 'eosio.ram', 'permission': 'active'}], 'data': '00000000001aa36a000090e602ea3055940000000000000004454f5300000000076275792072616d'}, 'context_free': False, 'elapsed': 1, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [], 'return_value': ''}, {'action_ordinal': 8, 'creator_action_ordinal': 5, 'closest_unnotified_ancestor_action_ordinal': 5, 'receipt': {'receiver': 'hello', 'act_digest': '8936fa535712d0095a1fcdcaec686c5ee65678aef36efa058a687675863e47ae', 'global_sequence': 71, 'recv_sequence': 3, 'auth_sequence': [['hello', 7]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'hello', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36aa0d492e602ea3055010000000000000004454f53000000000772616d20666565'}, 'context_free': False, 'elapsed': 1, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [], 'return_value': ''}, {'action_ordinal': 9, 'creator_action_ordinal': 5, 'closest_unnotified_ancestor_action_ordinal': 5, 'receipt': {'receiver': 'eosio.ramfee', 'act_digest': '8936fa535712d0095a1fcdcaec686c5ee65678aef36efa058a687675863e47ae', 'global_sequence': 72, 'recv_sequence': 1, 'auth_sequence': [['hello', 8]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'eosio.ramfee', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36aa0d492e602ea3055010000000000000004454f53000000000772616d20666565'}, 'context_free': False, 'elapsed': 1, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [], 'return_value': ''}, {'action_ordinal': 10, 'creator_action_ordinal': 3, 'closest_unnotified_ancestor_action_ordinal': 3, 'receipt': {'receiver': 'eosio.token', 'act_digest': '6ff01b8935c3ead9d5c59a5f278096f342d16a73f4930bb39b373495e5e35f5e', 'global_sequence': 74, 'recv_sequence': 9, 'auth_sequence': [['hello', 10]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'eosio.token', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36a0014341903ea3055000800000000000004454f53000000000f7374616b652062616e647769647468'}, 'context_free': False, 'elapsed': 10, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [{'account': 'hello', 'delta': 240}], 'return_value': ''}, {'action_ordinal': 11, 'creator_action_ordinal': 10, 'closest_unnotified_ancestor_action_ordinal': 10, 'receipt': {'receiver': 'hello', 'act_digest': '6ff01b8935c3ead9d5c59a5f278096f342d16a73f4930bb39b373495e5e35f5e', 'global_sequence': 75, 'recv_sequence': 4, 'auth_sequence': [['hello', 11]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'hello', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36a0014341903ea3055000800000000000004454f53000000000f7374616b652062616e647769647468'}, 'context_free': False, 'elapsed': 1, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [], 'return_value': ''}, {'action_ordinal': 12, 'creator_action_ordinal': 10, 'closest_unnotified_ancestor_action_ordinal': 10, 'receipt': {'receiver': 'eosio.stake', 'act_digest': '6ff01b8935c3ead9d5c59a5f278096f342d16a73f4930bb39b373495e5e35f5e', 'global_sequence': 76, 'recv_sequence': 1, 'auth_sequence': [['hello', 12]], 'code_sequence': 1, 'abi_sequence': 1}, 'receiver': 'eosio.stake', 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'hello', 'permission': 'active'}], 'data': '00000000001aa36a0014341903ea3055000800000000000004454f53000000000f7374616b652062616e647769647468'}, 'context_free': False, 'elapsed': 1, 'console': '', 'trx_id': 'a4386e7737738a49e8a3388d96cd7c3ff9250bcdbb55ed08873b7d7382478d9b', 'block_num': 7, 'block_time': '2018-06-01T12:00:03.000', 'account_ram_deltas': [], 'return_value': ''}], 'failed_dtrx_trace': None, 'except': {'code': 3080001, 'name': 'ram_usage_exceeded', 'message': 'Account using more than allotted RAM usage', 'stack': [{'context': {'level': 'error', 'file': 'resource_limits.cpp', 'line': 233, 'method': 'verify_account_ram_usage', 'hostname': '', 'thread_name': 'ipyeos', 'timestamp': '2022-12-08T17:37:55.729'}, 'format': 'account ${account} has insufficient ram; needs ${needs} bytes has ${available} bytes', 'data': {'account': 'delphioracle', 'needs': 3558, 'available': 2417}}]}, 'error_code': '10000000000000000000'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant