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

No response from node while creating asset with wrong value of max_supply #1688

Closed
1 of 17 tasks
bitphage opened this issue Mar 29, 2019 · 3 comments · Fixed by bitshares/bitshares-fc#135
Closed
1 of 17 tasks
Assignees
Labels
1b User Story The User Story details a requirement. It may reference a parent Epic. It may reference child Task(s) 3d Bug Classification indicating the existing implementation does not match the intention of the design 6 API Impact flag identifying the application programing interface (API) 6 UX Impact flag identifying the User Interface (UX)

Comments

@bitphage
Copy link

Tried to create an asset passing max_supply > uint64. Node didn't return any response at all. Expected behavior is to get an assertion error from the node.

1230341ms th_a       websocket_api.cpp:152         on_message           ] e.to_detail_string(): 4 parse_error_exception: Parse Error
Couldn't parse uint64_t
    {}
    th_a  string.cpp:115 to_uint64

    {"i":"20000000000000000000"}
    th_a  string.cpp:118 to_uint64
Error parsing object
    {}
    th_a  json.cpp:224 objectFromStreamBase
Error parsing object
    {}
    th_a  json.cpp:224 objectFromStreamBase
Attempting to parse array [10]
    {"array":[10]}
    th_a  json.cpp:261 arrayFromStreamBase
Attempting to parse array []
    {"array":[]}
    th_a  json.cpp:261 arrayFromStreamBase
Attempting to parse array []
    {"array":[]}
    th_a  json.cpp:261 arrayFromStreamBase
Attempting to parse array [0,"get_required_fees"]
    {"array":[0,"get_required_fees"]}
    th_a  json.cpp:261 arrayFromStreamBase
Error parsing object
    {}
    th_a  json.cpp:224 objectFromStreamBase

    {"str":"{\"method\": \"call\", \"params\": [0, \"get_required_fees\", [[[10, {\"fee\": {\"amount\": 0, \"asset_id\": \"1.3.0\"}, \"issuer\": \"1.2.6\", \"symbol\": \"MYQUOTE\", \"precision\": 5, \"common_options\": {\"max_supply\": 20000000000000000000, \"market_fee_percent\": 0, \"max_market_fee\": 10000000000000, \"issuer_permissions\": 79, \"flags\": 0, \"core_exchange_rate\": {\"base\": {\"amount\": 1, \"asset_id\": \"1.3.0\"}, \"quote\": {\"amount\": 1, \"asset_id\": \"1.3.1\"}}, \"whitelist_authorities\": [], \"blacklist_authorities\": [], \"whitelist_markets\": [], \"blacklist_markets\": [], \"description\": \"\", \"extensions\": []}, \"is_prediction_market\": false, \"extensions\": []}]], \"1.3.0\"]], \"jsonrpc\": \"2.0\", \"id\": 38}"}
    th_a  json.cpp:463 from_string 

Impacts
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.

  • API (the application programming interface)
  • Build (the build process or something prior to compiled code)
  • CLI (the command line wallet)
  • Deployment (the deployment process after building such as Docker, Travis, etc.)
  • DEX (the Decentralized EXchange, market engine, etc.)
  • P2P (the peer-to-peer network for transaction/block propagation)
  • Performance (system or user efficiency, etc.)
  • Protocol (the blockchain logic, consensus, validation, etc.)
  • Security (the security of system or user data, etc.)
  • UX (the User Experience)
  • Other (please add below)

Host Environment

  • BitShares Version: docker image bitshares/bitshares-core:testnet dad6ee6283a3

CORE TEAM TASK LIST

  • Evaluate / Prioritize Bug Report
  • Refine User Stories / Requirements
  • Define Test Cases
  • Design / Develop Solution
  • Perform QA/Testing
  • Update Documentation
@oxarbitrage
Copy link
Member

This is a bit tricky but thank you for the report.

The node should be able to handle your number as max_supply is share_type(aka u128) but the problem is in the json parsing.

According to your log, the error is produced in get_required_fees api call but i dont think the fix should be implemented there but in the json parsing, inside fc.

Comments are welcome, i will dig some more.

@oxarbitrage oxarbitrage added 1b User Story The User Story details a requirement. It may reference a parent Epic. It may reference child Task(s) 2a Discussion Needed Prompt for team to discuss at next stand up. 3d Bug Classification indicating the existing implementation does not match the intention of the design 6 UX Impact flag identifying the User Interface (UX) labels Mar 30, 2019
@pmconrad
Copy link
Contributor

I think the root of the problem is that the JSON parser fails to parse the websocket request. I didn't try via websocket, but this call via HTTP prints an error message similar to the one above:

{"id":0,"method":"get_required_fees","params":[[
 [10,{"symbol": "ARGH", "common_options": { "max_supply": 20000000000000000000 } }]
], "BTS"]}

Perhaps the error message is not formatted properly and therefore not recognized by the websocket client.

Workaround: enclose the large number in double quotes, like this:

{"id":0,"method":"get_required_fees","params":[[
 [10,{"symbol": "ARGH", "common_options": { "max_supply": "20000000000000000000" } }]
], "BTS"]}

Response:

{"id":0,"jsonrpc":"2.0","error":{"code":1,"message":"Parse Error: Couldn't parse int64_t","data":{"code":4,"name":"parse_error_exception","message":"Parse Error","stack":[{"context":{"level":"error","file":"string.cpp","line":102,"method":"to_int64","hostname":"","thread_name":"th_a","timestamp":"2019-03-31T12:35:32"},"format":"Couldn't parse int64_t","data":{}},{"context":{"level":"warn","file":"websocket_api.cpp","line":125,"method":"on_message","hostname":"","thread_name":"th_a","timestamp":"2019-03-31T12:35:32"},"format":"","data":{"call.method":"get_required_fees","call.params":[[[10,{"symbol":"ARGH","common_options":{"max_supply":"20000000000000000000"}}]],"BTS"]}}]}}}

I agree this needs to be fixed within fc, perhaps in the websocket server.

@pmconrad pmconrad added the 6 API Impact flag identifying the application programing interface (API) label Mar 31, 2019
@abitmore abitmore added this to the Future Feature Release milestone Apr 8, 2019
@pmconrad pmconrad self-assigned this May 22, 2019
@pmconrad pmconrad added 2d Developing Status indicating currently designing and developing a solution and removed 2a Discussion Needed Prompt for team to discuss at next stand up. labels May 22, 2019
@abitmore
Copy link
Member

abitmore commented May 28, 2019

Will close after bumped FC (probably in #1768).

@abitmore abitmore reopened this May 28, 2019
@pmconrad pmconrad added 2f Testing Status indicating the solution is being evaluated against the test case(s) and removed 2d Developing Status indicating currently designing and developing a solution labels May 28, 2019
@pmconrad pmconrad removed the 2f Testing Status indicating the solution is being evaluated against the test case(s) label Jun 4, 2019
@pmconrad pmconrad closed this as completed Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1b User Story The User Story details a requirement. It may reference a parent Epic. It may reference child Task(s) 3d Bug Classification indicating the existing implementation does not match the intention of the design 6 API Impact flag identifying the application programing interface (API) 6 UX Impact flag identifying the User Interface (UX)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants